.TH defined "" "" "Preprocessor Operator"
.PC "Perform an action if a macro is defined"
.PP
The preprocessor directive
.B defined
determines whether a symbol is defined to the
.B #if
preprocessor directive.
For example,
.DM
	#if defined(SYMBOL)
.DE
.PP
or
.DM
	#if defined SYMBOL
.DE
.PP
is equivalent to
.DM
	#ifdef SYMBOL
.DE
.PP
except that it can be used in more complex expressions, such as
.DM
	#if defined FOO && defined BAR && FOO==10
.DE
.PP
.B defined
is recognized only in lines beginning with
.B #if
or
.BR #elif .
.SH "See Also"
.Xr "#elif," _23elif
.Xr "#if," _23if
.Xr "#ifdef," _23ifdef
.Xr "cpp," cpp
.Xr "C preprocessor" c_preproc
.br
\*(AS, \(sc6.8.1
.SH Notes
Note that
.B 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
.B defined()
without any complaint from the C compiler; and if
.B defined
does not appear within an
.B #if
or
.B #elif
directive, the preprocessor ignores it.
.\" strange creature, that ...
