Texas Instruments TMS34010 Reference Manual page 168

C compiler
Hide thumbs Also See for TMS34010:
Table of Contents

Advertisement

Conditional Processing
Directives
#if /#ifdef /#ifndef /#else/#end if
Syntax
#if constant-expression
code to compile if condition is true
[#else
code to compile if condition is false]
#endif
#ifdef name
code to compile if name is defined
[#else
code to compile if name is not defined]
#endif
#ifndef name
code to compile if name is not defined
[#else
code to compile if name is defined]
#endif
Description
The C preprocessor supports several conditional processing directives:
Three directives can begin a conditional block:
The #if directive tests an expression. The code following an #if
directive (up to an #else or an #endif) is compiled if the con-
stant-expression evaluates to a nonzero value. All binary non-
assignment C operators, the 7: operator, the unary -, I, and %
operators are legal in constant-expression. The precedence of
the operators is the same as in the definition of the C language.
The preprocessor also supports a unary operator named de-
fined, which can be used in constant-expression in one of two
forms:
1)
defined«name»
or
2)
def ined <name>
This allows the the utility of #ifdef and #ifndef in an #if directive.
Only these operators, integer constants, and names which are
known by the preprocessor should be used in constant-
expression. In particular, the sizeof operator should not be used.
The #ifdef directive tests to see if name is a defined constant.
The code following an #ifdef directive (up to an #else or an
#endif) is compiled if name is defined (by the #define directive)
and it has not been undefined by the #undef directive.
The #ifndef directive tests to see if name is not a defined con-
stant. The code following an #ifndef directive (up to an #else:
or an #endif) is compiled if name is not defined (by the #define
directive) or if it was undefined by the #undef directive.
8-3

Advertisement

Table of Contents
loading

Table of Contents