Defined - 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

Chapter 4. Conditionals
controlled text
#endif /*
expression
is a C expression of integer type, subject to stringent restrictions. It may contain
expression
Integer constants.
Character constants, which are interpreted as they would be in normal code.
Arithmetic operators for addition, subtraction, multiplication, division, bitwise operations, shifts,
comparisons, and logical operations (
rules of standard C.
Macros. All macros in the expression are expanded before actual computation of the expression's
value begins.
Uses of the
defined
an
.
#if
Identifiers that are not macros, which are all considered to be the number zero. This allows you
to write
#if MACRO
always have a nonzero value. Function-like macros used without their function call parentheses are
also treated as zero.
In some contexts this shortcut is undesirable. The
it encounters an identifier which is not a macro in an
The preprocessor does not know anything about types in the language. Therefore,
are not recognized in
not macros, and replaced by zero. In the case of
invalid.
The preprocessor calculates the value of
integer type known to the compiler; on most machines supported by GCC this is 64 bits. This is not the
same rule as the compiler uses to calculate the value of a constant expression, and may give different
results in some cases. If the value comes out to be nonzero, the
is included; otherwise it is skipped.
text
If
is not correctly formed, GCC issues an error and treats the conditional as having
expression
failed.
4.2.3. Defined
The special operator
is defined as a macro.
is defined as a macro at the current point in the program, and 0 otherwise. Thus,
name
is precisely equivalent to
MACRO
is useful when you wish to test more than one macro for existence at once. For example,
defined
#if defined (__vax__) || defined (__ns16000__)
would succeed if either of the names
Conditionals written like this:
*/
&&
operator, which lets you check whether macros are defined in the middle of
instead of
#ifdef MACRO
, and neither are
#if
is used in
defined
#if
and
defined
name
#ifdef MACRO
__vax__
and
). The latter two obey the usual short-circuiting
||
, if you know that MACRO, when defined, will
-Wundef
.
#if
constants. They will be taken as identifiers which are
enum
, this is likely to cause the expression to be
sizeof
. It carries out all calculations in the widest
expression
and
expressions to test whether a certain name
#elif
are both expressions whose value is 1 if
defined (
)
name
.
or
__ns16000__
option causes GCC to warn whenever
sizeof
succeeds and the
#if
is defined as a macro.
35
operators
controlled
#if defined

Advertisement

Table of Contents
loading

This manual is also suitable for:

Enterprise linux 3

Table of Contents