RAD Studio |  |

Defined
See Also
Collapse All

Syntax

Copy Code

    #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.

Copy Code

    #if defined(mysym)

is the same as

Copy Code

    #ifdef mysym

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

Copy Code

    #if defined(mysym) && !defined(yoursym)

See Also

#ifdef And #ifndef

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