Code: Select all
{$Undefine Foo}
{$Undefine Bar}
{$IfDef Foo} // Since Foo is not defined...
{$Define Bar} // ...this definition should be ignored
{$EndIf}
{$IfDef Bar}
const
cMyConst = 1; // cMyConst takes this value...
{$Else}
const
cMyConst = 2; // ...instead of this one.
{$EndIf}
$Define and $Undefine should be ignored inside "dead" $IfDef / $Else / $Endif blocks, i.e. inside blocks of code that do not get compiled.
This is, IMHO, in the fix-it-by-yesterday category, as everyone who has ever used a preprocessor will expect a consistent behaviour.