COHERENT manpages

This page displays the COHERENT manpage for defined [Perform an action if a macro is defined].

List of available manpages
Index


defined -- Preprocessor Operator

Perform an action if a macro is defined

The preprocessor  directive defined determines whether  a symbol is defined
to the #if preprocessor directive.  For example,

    #if defined(SYMBOL)

or

    #if defined SYMBOL

is equivalent to

    #ifdef SYMBOL

except that it can be used in more complex expressions, such as

    #if defined FOO && defined BAR && FOO==10

defined is recognized only in lines beginning with #if or #elif.

See Also

#elif,
#if,
#ifdef,
cpp,
C preprocessor
ANSI Standard, §6.8.1

Notes

Note that defined is  a preprocessor operator, not a preprocessor directive
or a  C keyword.  The  difference lies in  the fact that you  could write a
function called defined() without any complaint from the C compiler; and if
defined does not appear within  an #if or #elif directive, the preprocessor
ignores it.