I have run into a bug with gcc v3.4.4 and which to put an #ifdef in my code to work around the bug for only that version of the compiler.
What are the GCC compiler p
There's 3 macros for the gcc version you can test on.
__GNUC_MINOR__ __GNUC_PATCHLEVEL__ __GNUC__
e.g. my gcc v 4.3.1 defines them as such:
#define __GNUC_MINOR__ 1 #define __GNUC_PATCHLEVEL__ 3 #define __GNUC__ 4
You can see the "buitin" macros defined by running
gcc -E -dM -x c /dev/null