Re: [Predef-contribute] Meaning of __GNUC__
Brought to you by:
breese,
tahonermann
|
From: Bjorn R. <br...@ma...> - 2008-07-13 10:55:55
|
Ming Kin Lai wrote: > Currently, in the Pre-defined Compiler Macros for Compilers web page, __GNUC__ is listed as an identification macro for GNU C/C++ compiler. After some research and > discussion with others, I believe it is not exactly accurate, though it used to be > correct some years ago. [...] > It seems this 1997 definition is more strict: a non-GCC compiler should never define > __GNUC__. In other words, in 1997, __GNUC__ can be used to uniquely identify > the GNU C compiler, now it can't; and nothing can. Currently there is no macro > to identify the compiler as the GNU C Compiler. Ok, I have changed the note of caution to: "Please note that the meaning of the __GNUC__ macro has changed subtly over the years, from identifying the GNU C/C++ compiler to identifying any compiler that implements the GNU compiler extensions (see "Feature request - a macro defined for GCC" [1] discussion for further information). For example, the Intel C++ on Linux also defines these macros from version 8.1 (see the "Intel C++ Compiler 8.1 for Linux Release Notes" [2] and "Intel Compilers for Linux: Compatibility with GNU Compilers" [3].)" where [1] http://gcc.gnu.org/ml/gcc/2008-07/threads.html#00025 [2] ftp://download.intel.com/support/performancetools/c/linux/sb/clin81_relnotes.pdf [3] http://www.intel.com/cd/software/products/asmo-na/eng/284736.htm Is this a satisfactory description? > And look even more carefully at what the current CPP Manual says: > "These macros are defined by all GNU compilers that use the C preprocessor: C, > C++, Objective-C and Fortran". That is, the GNU Fortran Compiler also has > __GNU__ defined. Note that now GCC means GNU Compiler Collection, not GNU C I consider Objective-C and Fortran out of scope for the predef pages, which only targets people writing C and C++ source code files. |