RAD Studio
ContentsIndex
PreviousUpNext
#ifdef And #ifndef

Syntax

#ifdef identifier
#ifndef identifier

Description 

The #ifdef and #ifndef conditional directives let you test whether an identifier is currently defined or not; that is, whether a previous #define command has been processed for that identifier and is still in force. The line

#ifdef identifier

has exactly the same effect as

#if 1

if identifier is currently defined, and the same effect as

#if 0

if identifier is currently undefined. 

#ifndef tests true for the "not-defined" condition, so the line

#ifndef identifier

has exactly the same effect as

#if 0

if identifier is currently defined, and the same effect as

#if 1

if identifier is currently undefined. 

The syntax thereafter follows that of the #if, #elif, #else, and #endif

An identifier defined as NULL is considered to be defined.

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