Else; Elif - Red Hat ENTERPRISE LINUX 3 - USING CPP Using Instructions

Using cpp, the c preprocessor
Hide thumbs Also See for ENTERPRISE LINUX 3 - USING CPP:
Table of Contents

Advertisement

36
#if defined BUFSIZE && BUFSIZE
can generally be simplified to just
be interpreted as having the value zero.
If the
operator appears as a result of a macro expansion, the C standard says the behavior is
defined
undefined. GNU cpp treats it as a genuine
wherever your code uses this feature if you use the command-line option
compilers may handle it differently.

4.2.4. Else

The
directive can be added to a conditional to provide alternative text to be used if the condition
#else
fails. This is what it looks like:
#if
expression
text-if-true
#else /* Not
expression
text-if-false
#endif /* Not
expression
If
is nonzero, the
expression
is zero, the opposite happens.
expression
You can use
with
#else

4.2.5. Elif

One common case of nested conditionals is used to check for more than two possible alternatives. For
example, you might have
#if X == 1
...
#else /* X != 1 */
#if X == 2
...
#else /* X != 2 */
...
#endif /* X != 2 */
#endif /* X != 1 */
Another conditional directive,
#if X == 1
...
#elif X == 2
...
#else /* X != 2 and X != 1*/
...
#endif /* X != 2 and X != 1*/
"
= 1024
#if BUFSIZE
defined
*/
*/
text-if-true
and
#ifdef
#ifndef
, allows this to be abbreviated as follows:
#elif
"
, since if
= 1024
operator and evaluates it normally. It will warn
is included and the
, too.
Chapter 4. Conditionals
is not defined, it will
BUFSIZE
, since other
-pedantic
is skipped. If
text-if-false

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents