[fpc-devel] RFC: changing conditional compilation

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Feb 9 11:31:41 CET 2010

On 09 Feb 2010, at 01:24, Flávio Etrusco wrote:

>> As far as I know, that's how macros behave.
>> E.g.:
>> {$macro on}
>> {$define xxx:=1}
>> {$if xxx}
>> begin
>> end.
>> {$endif}
>> If you undefine "xxx", you'll get a compile time error.
>> Downside: they don't work with booleans for some reason, only with  
>> integers...
> Hi Jonas,
> As you can imagine I'd prefer to "solve" the $ifdef "problem" ;-)

To be honest: no, I can't imagine why you would prefer that. The  
entire difference between $ifdef and $if is that $if checks the value  
of something (and hence will give an error if the symbol is undefined)  
and $ifdef checks whether it is defined or not. As far as I can tell,  
you would simply like to be able to use boolean constants in $if  

> Yes, I noticed the problem with bools - and that it would fail with
> "string found but boolean expected" if the name was undefined -,

The latter is the behaviour you want, no?


PS: please reply to the list

More information about the fpc-devel mailing list