Deleted Code - Red Hat ENTERPRISE LINUX 4 - USING CPP Using Instructions

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

Advertisement

Chapter 4. Conditionals
41
stands for "else if". Like
, it goes in the middle of a conditional group and subdivides
#elif
#else
it; it does not require a matching
of its own. Like
, the
directive includes an
#endif
#if
#elif
expression to be tested. The text following the
is processed only if the original
-condition
#elif
#if
failed and the
condition succeeds.
#elif
More than one
can go in the same conditional group. Then the text after each
is pro-
#elif
#elif
cessed only if the
condition succeeds after the original
and all previous
directives
#elif
#if
#elif
within it have failed.
is allowed after any number of
directives, but
may not follow
.
#else
#elif
#elif
#else

4.3. Deleted Code

If you replace or delete a part of the program but want to keep the old code around for future reference,
you often cannot simply comment it out. Block comments do not nest, so the first comment inside the
old code will end the commenting-out. The probable result is a flood of syntax errors.
One way to avoid this problem is to use an always-false conditional instead. For instance, put
#if 0
before the deleted code and
after it. This works even if the code being turned off contains
#endif
conditionals, but they must be entire conditionals (balanced
and
).
#if
#endif
Some people use
instead. This is risky, because
might be accidentally de-
#ifdef notdef
notdef
fined as a macro, and then the conditional would succeed.
can be counted on to fail.
#if 0
Do not use
for comments which are not C code. Use a real comment, instead. The interior
#if 0
of
must consist of complete tokens; in particular, single-quote characters must balance. Com-
#if 0
ments often contain unbalanced single-quote characters (known in English as apostrophes). These
confuse
. They don't confuse
.
#if 0
/*

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the ENTERPRISE LINUX 4 - USING CPP and is the answer not in the manual?

Questions and answers

This manual is also suitable for:

Enterprise linux 4

Table of Contents