Stdc in normal operation this macro expands to the

Info icon This 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.
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.
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 ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern