Menu

#1 Problem with Defines

open
nobody
None
5
2005-10-20
2005-10-20
Anonymous
No

You may already be aware of the following.

This code will not compile in the IDE with dppPlugin
installed.
(------------------------------------------------------------------------------)
program MacroTest;

{$APPTYPE CONSOLE}

{$DEFINE Supports_Macros}

{$IFDEF Supports_Macros}

{$DEFINE HasSupport 'Yes'}

{$ELSE}

const HasSupport = 'No';

{$ENDIF}

begin
WriteLn('Has Macro Support: ', HasSupport);
ReadLn;
end.
(------------------------------------------------------------------------------)
Gives the error: 'Undeclared Identifier: 'HasSupport''. To
get it working properly you would have to
define 'Supports_Macros' as a macro.
{$DEFINE Supports_Macros 1}

Also, It seems that dpp does not handle the above code
correctly either. It also parses and converts the 'False'
parts of conditional code.
const HasSupport = 'No';
becomes
const 'yes' = 'No';

Discussion


Log in to post a comment.

MongoDB Logo MongoDB