Reputation: 3463
Can I combine some IFDEFS in my source?
For example:
{$IFDEF INCOMING or OUTGOING}
...
{$ENDIF}
Upvotes: 12
Views: 4742
Reputation: 910
Here's a variation of David's answer using 'not'.
I use this when I want to disable the splash screen on my apps while in debug mode. It prevents me from accidentally leaving the splash disabled if I forget to undefine NOSPLASH in the release build.
{$IF not (Defined(NOSPLASH) AND Defined(DEBUG))}
//code to create splash
{$IFEND}
Upvotes: 1
Reputation: 37211
Alternative, for older versions:
{$IFDEF INCOMING}
{$DEFINE INCOMING_OR_OUTGOING}
{$ENDIF}
{$IFDEF OUTGOING}
{$DEFINE INCOMING_OR_OUTGOING}
{$ENDIF}
{$IFDEF INCOMING_OR_OUTGOING}
...
{$ENDIF}
Upvotes: 14
Reputation: 16259
I don't believe the $IFDEF supports it, but the $IF does. http://docs.embarcadero.com/products/rad_studio/delphiAndcpp2009/HelpUpdate2/EN/html/devcommon/compdirsifdirective_xml.html
Upvotes: 3
Reputation: 612794
Use $IF
with Defined()
rather than $IFDEF
:
{$IF Defined(INCOMING) or Defined(OUTGOING)}
...
{$IFEND}
Upvotes: 21