Archive: Compiler !if behavior


Compiler !if behavior
Hello

I use the compiler !if, !ifdef and so on extensivly in my scripts

But i recently stumbled over a odd behavior, example the code

!if ${MYVARIABLE} == "ADVANCED"
!warning "ok"
!else
!warning "ERROR"
!endif

First of all it is case sensitive
which is odd because the rest of NSIS is case insensitive (strcmp ...) and it isn't referenced in the documentation

Second if i use the makensis script with the /D option
I have to write /DMYVARIABLE="ADVANCED"

I don't understand why i have to put the " around?

or doesn't the compiler distinguish between strings and defines?

hopefully somebody can bring some light in this issue

The parser strips the quotes of parameters, so there's no difference between "ADVANCED" and ADVANCED. You must have had a typo somewhere. For example, this works:

!define a a
!if ${a} == "a"
!error blah
!endif
!if will be case insensitive, like !if and StrCmp in the next version. Thanks for the notice.