According to the helpfile:
This directive does not seem to work, but $UNDEF does work as intended, see code below:Use $UNDEFINE to undefine (“clear”) previously defined flag.
Code: Select all
program Undefinetest;
var str: string[10];
begin
{$DEFINE abc}
{$IFDEF abc}
Str := 'abc'; // <--- executed, OK
{$ELSE}
Str := 'def';
{$ENDIF}
{$UNDEFINE abc}
{$IFDEF abc}
Str := 'abc'; // <--- executed, NOT OK
{$ELSE}
Str := 'def';
{$ENDIF}
{$UNDEF abc}
{$IFDEF abc}
Str := 'abc';
{$ELSE}
Str := 'def';// <--- executed, OK, apparently $UNDEF does undefine
{$ENDIF}
{$DEFINE abc}
{$IFDEF abc}
Str := 'abc';// <--- executed, OK
{$ELSE}
Str := 'def';
{$ENDIF}
end.