Funny christmas bug

Just starting out? Need help? Post your questions and find answers here.
User avatar
max_aigneraigner@web.de
User
User
Posts: 67
Joined: Sun Nov 02, 2008 10:37 pm
Location: Bavaria
Contact:

Funny christmas bug

Post by max_aigneraigner@web.de »

Hi Forum,

we were just messing a bit around in the german purebasic forum,
and found SUDDENLY this .. comic.. mistake..

watch the amount of compilerendif / compilerif - s..

Code: Select all

Macro If_Home_is_defined
  CompilerIf ((~Defined(home,#PB_Constant)) & %00000001)
EndMacro 

Macro then_write_hello
  Debug "hallo"
EndMacro 

Macro and_go_Home
   CompilerEndIf 
EndMacro 

; ------------------------------------------------------------
; ----DELETE THIS CONSTANT to see the MIRACLE --------------
; ------------------------------------------------------------

#home = 1


; ----

If_Home_is_defined
then_write_hello
and_go_Home
CompilerEndIf
Amazing, right?
bug or not?

:)

merry christmas and a happy new year

-walker

on purebasic 4.51 *86 windows 7 etc..
3D Projects
A ship is safest in the harbor, but that is not what ships are built for.
freak
PureBasic Team
PureBasic Team
Posts: 5948
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Re: Funny christmas bug

Post by freak »

This is correct. Code between CompilerIf and CompilerEndIf is not compiled, so 'and_go_Home' never gets expanded. There is just one CompilerEndIf.
quidquid Latine dictum sit altum videtur
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Funny christmas bug

Post by blueznl »

Not a bug. Though a bit unexpected :-)

None of the code between CompilerIf / CompilerEndIf seems to be processed, including any macros...

This behaves the same:

Code: Select all

Macro x_compilerendif
  CompilerEndIf
EndMacro
;
#home = 1
;
CompilerIf ((~Defined(home,#PB_Constant)) & %00000001)
  Debug "hallo"
  x_compilerendif
CompilerEndIf
And this shows what happens:

Code: Select all

Macro x_compilerendif
  CompilerEndIf
EndMacro
;
#home = 1
;
CompilerIf ((~Defined(home,#PB_Constant)) & %00000001)
  Debug "hallo"
x_compilerendif
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
max_aigneraigner@web.de
User
User
Posts: 67
Joined: Sun Nov 02, 2008 10:37 pm
Location: Bavaria
Contact:

Re: Funny christmas bug

Post by max_aigneraigner@web.de »

Damn Axe.. we say in bavaria.. (verdammte Axt..)
so compilerif has a higher priority than a macro o.O...
I would like to choose the priority.. well.. in this case ^^ :)

ok, so thanks for helping again :)

and have a good flush into the next year :)
3D Projects
A ship is safest in the harbor, but that is not what ships are built for.
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: Funny christmas bug

Post by c4s »

max_aigneraigner@web.de wrote:and have a good flush into the next year :)
I think "Happy New Year" is what you want to say. To me this sounds more like being on the toilet. :lol:
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6172
Joined: Sat May 17, 2003 11:31 am
Contact:

Re: Funny christmas bug

Post by blueznl »

Something which also needs to be taken care of... otherwise it will be a new year but not a happy one :-)
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB - upgrade incoming...)
( The path to enlightenment and the PureBasic Survival Guide right here... )
Post Reply