2010/2/9 Jonas Maebe <jonas.ma...@elis.ugent.be>: > > 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.
Because everybody automatically uses $ifdef and most of the code would work with minor intervention. E.g. we usually use something like {.$define EnableDocking} to undefine the symbol. You'd just have to force it explicitly $undef or some kind of {$define EnableDocking disable} or 'false', or something. > 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 expressions. This would solve the problem for my code, not conditionals I'm trying to use on 3rd party code... >> 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? Yes - apart from puzzling error message to the casual users - but it'd require to set a convention on the Macro value for on/off and back to possibly causing errors due to typos. > Jonas > > PS: please reply to the list_______________________________________________ Sorry, I just skip the list sometimes when I think the post will be just noise to other people. I'd certainly get back to it when I have something relevant to say ;-) Best regards, Flávio _______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel