{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Stdc in normal operation this macro expands to the

Info iconThis preview shows pages 26–28. Sign up to view the full content.

View Full Document Right Arrow Icon
__STDC__ In normal operation, this macro expands to the constant 1, to signify that this compiler conforms to ISO Standard C. If GNU CPP is used with a compiler other than GCC, this is not necessarily true; however, the preprocessor always conforms to the standard unless the ‘ -traditional-cpp ’ option is used. This macro is not defined if the ‘ -traditional-cpp ’ option is used. On some hosts, the system compiler uses a different convention, where __STDC__ is normally 0, but is 1 if the user specifies strict conformance to the C Standard. CPP follows the host convention when processing system header files, but when processing user files __STDC__ is always 1. This has been reported to cause problems; for instance, some versions of Solaris provide X Windows headers that expect __STDC__ to be either undefined or 1. See Chapter 12 [Invocation], page 56 . __STDC_VERSION__ This macro expands to the C Standard’s version number, a long integer con- stant of the form yyyymm L where yyyy and mm are the year and month of the Standard version. This signifies which version of the C Standard the com- piler conforms to. Like __STDC__ , this is not necessarily accurate for the entire implementation, unless GNU CPP is being used with GCC. The value 199409L signifies the 1989 C standard as amended in 1994, which is the current default; the value 199901L signifies the 1999 revision of the C standard. Support for the 1999 revision is not yet complete. This macro is not defined if the ‘ -traditional-cpp ’ option is used, nor when compiling C ++ or Objective-C. __STDC_HOSTED__ This macro is defined, with value 1, if the compiler’s target is a hosted envi- ronment . A hosted environment has the complete facilities of the standard C library available. __cplusplus This macro is defined when the C ++ compiler is in use. You can use __ cplusplus to test whether a header is compiled by a C compiler or a C ++ compiler. This macro is similar to __STDC_VERSION__ , in that it expands to a version number. A fully conforming implementation of the 1998 C ++ standard will define this macro to 199711L . The GNU C ++ compiler is not yet fully conforming, so it uses 1 instead. It is hoped to complete the implementation of standard C ++ in the near future. __OBJC__ This macro is defined, with value 1, when the Objective-C compiler is in use. You can use __OBJC__ to test whether a header is compiled by a C compiler or an Objective-C compiler.
Background image of page 26

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Chapter 3: Macros 23 __ASSEMBLER__ This macro is defined with value 1 when preprocessing assembly language. 3.7.2 Common Predefined Macros The common predefined macros are GNU C extensions. They are available with the same meanings regardless of the machine or operating system on which you are using GNU C or GNU Fortran. Their names all start with double underscores. __COUNTER__ This macro expands to sequential integral values starting from 0. In conjunction with the ## operator, this provides a convenient means to generate unique iden- tifiers. Care must be taken to ensure that __COUNTER__ is not expanded prior to inclusion of precompiled headers which use it. Otherwise, the precompiled headers will not be used.
Background image of page 27
Image of page 28
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}