>>>
>>>You need to compile the code first (just that program, not the whole application).
>>
>>Thank you. This is what I was missing.
>
>Glad to help :) Though how did the program work without compiling? :) For me it always re-compiles when I make a change.
That depends on options you set. You don't need to check "Compile before saving". And thus you can experience a false branch to execute if you changed code. Advantage of #IF #ELSE #ENDIF over IF ELSE ENDIF is of course smaller object code.
It's rather hassle free to set that "Compile before saving" option, but it can bloat a vcx. By default it's off - I think. It's also not helping if you change a .h file you include in your prg. That does not trigger recompilation. It's not that useful for switching from debug mode to prodcution. _vfp.startmode is much better for that, you don't even need to change a constant to switch from debug to production. Just don't use it with
#IF:
#if _vfp.StartMode=0
? "the startmode is 0"
#else
? "the startmode is not 0, it's",_vfp.StartMode
#endif
copy this to command window, select it, right click "execute selection". Surprise :)
Just keep in mind #IF lExpression evaluates lExpression at compile time, not at runtime and think of the consequences. In this case, at compile time _vfp.Startmode is not 0, it's neither 1-5.
If you want a switch which does not need a recompile and should depend on startmode, use:
if _vfp.StartMode=0
? "ide, interactive"
else
? "the startmode is ",_vfp.StartMode
endif
If you want a switch to start or not start debugger, which does not need a recompile and should not depend on startmode, use ASSERT in conjunction with SET ASSERTS ON/OFF.
precompiler #IF is in fact okay for leaving out debug code from the exe version, but it's not that comfortable.
Bye, Olaf.