RAD Studio
ContentsIndex
PreviousUpNext
Defined

Syntax

#if defined[(] <identifier> [)]
#elif defined[(] <identifier> [)]

Description 

Use the defined operator to test if an identifier was previously defined using #define. The defined operator is only valid in #if and #elif expressions. 

Defined evaluates to 1 (true) if a previously defined symbol has not been undefined (using #undef); otherwise, it evaluates to 0 (false). 

Defined performs the same function as #ifdef.

#if defined(mysym)

is the same as

#ifdef mysym

The advantage is that you can use defined repeatedly in a complex expression following the #if directive; for example,

#if defined(mysym) && !defined(yoursym)
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!