Predefined C defines

Ian Lance Taylor iant@google.com
Tue Aug 15 17:35:00 GMT 2006


rod.niner@gm.com writes:

> Normally there are #defines build into compilers to detect compiler type,
> version and chip types.
> Is there a list of these some place
> I seem to remember I  could wrap code around an #ifdef _GNU so that when
> the compiler would change I could alert others to compiler specific
> sections of code.

The exact set of predefined macros will vary depending on the command
line arguments.  You can see them by doing this:
    gcc -E -dD -x c /dev/null
along with whatever other arguments you want to pass.

gcc does not define _GNU, but it does define __GNUC__.

Ian



More information about the Gcc-help mailing list