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) 2008 CodeGear(TM). All Rights Reserved.
|
What do you think about this topic? Send feedback!
|