[fpc-devel] RFC: changing conditional compilation
Jonas Maebe
jonas.maebe at elis.ugent.be
Tue Feb 9 00:24:12 CET 2010
On 09 Feb 2010, at 00:01, Flávio Etrusco wrote:
> Now there's Macros, but they
> wouldn't solve the problem either, unless you'd use some crazy scheme
> with "$if declared" or something AFAICS.
> What I wished is to change (or add a directive to change) the way
> $ifdef/ifndef work, enforcing that symbols are always declared, like
> it was a boolean. So one would have to use e.g. {$define EnableFeature
> false} to "undefine" it, otherwise conditionals would fail.
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...
Jonas
More information about the fpc-devel
mailing list