[fpc-devel] RFC: changing conditional compilation

Flávio Etrusco flavio.etrusco at gmail.com
Tue Feb 9 00:01:09 CET 2010


Hello,

The problem I'm trying to solve is that I find the $define system to
have a (an unnecessary) propensity for errors caused by typos; if you
don't agree please ignore my YAAP (yet another annoying proposition).

Because of this propensity for erros with the $define system (and
because it causes unnecessary recompilation), I usually prefer to use
'consts' whenever possible; of course this doesn't work for many
cases, including multiplatform development, where you have to omit
whole function declarations and calls. 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.

I can see it causing some minor annoyances, can anybody see any bigger
problem? (apart from thinking the idea is pointless, which should have
caused you to stop reading in the first paragraph ;-)

Best regards,
Flávio



More information about the fpc-devel mailing list