3.7.4. C++ Named Operators. Red Hat ENTERPRISE LINUX 4 - USING BINUTILS, ENTERPRISE LINUX 4 - DEVELOPER TOOLS GUIDE
Hirdetés
Hirdetés
28 Chapter 3. Macros all. Chapter 12 Invocation . All system-specific predefined macros expand to the constant 1, so you can test them with either #ifdef or #if .
The C standard requires that all system-specific macros be part of the reserved namespace . All names which begin with two underscores, or an underscore and a capital letter, are reserved for the compiler and library to use as they wish. However, historically system-specific macros have had names with no special prefix; for instance, it is common to find unix defined on Unix systems. For all such macros,
GCC provides a parallel macro with two underscores added at the beginning and the end. If unix is defined, __unix__ will be defined too. There will never be more than two underscores; the parallel of
_mips is
__mips__
.
When the -ansi option, or any -std option that requests strict conformance, is given to the compiler, all the system-specific predefined macros outside the reserved namespace are suppressed. The parallel macros, inside the reserved namespace, remain defined.
We are slowly phasing out all predefined macros which are outside the reserved namespace. You should never use them in new programs, and we encourage you to correct older code to use the parallel macros whenever you find it. We don’t recommend you use the system-specific macros that are in the reserved namespace, either. It is better in the long run to check specifically for features you need, using a tool such as autoconf .
3.7.4. C++ Named Operators
In C++, there are eleven keywords which are simply alternate spellings of operators normally written with punctuation. These keywords are treated as such even in the preprocessor. They function as operators in
#if
, and they cannot be defined as macros or poisoned. In C, you can request that those keywords take their C++ meaning by including iso646.h
. That header defines each one as a normal object-like macro expanding to the appropriate punctuator.
These are the named operators and their corresponding punctuators:
Named Operator and and_eq bitand bitor compl not not_eq or or_eq xor xor_eq
~
!
!=
||
|=
^
^=
Punctuator
&&
&=
&
|
3.8. Undefining and Redefining Macros
If a macro ceases to be useful, it may be undefined with the #undef directive.
#undef takes a single argument, the name of the macro to undefine. You use the bare macro name, even if the macro is
Letöltés
Hirdetés