I'm guessing you've seen a bunch of ugly macros to detect the compiler on which the code is compiled. Something like this is a typical practice in C word:
#include <something_that_defines_macros> #if !defined(__clang__) \ && !defined(__ICC) \ && !defined(__INTEL_COMPILER) \ && (defined(__GNUC__) || defined(__GNUG__)) // GCC specific #endif
Now, try to come up with a good macro to detect the GCC compiler. Try to make that macro usage as short as possible.
Take a look at the following recipe to verify your guess.
The recipe is simple and consists of a single a header and a single macro.
- The header:
#include <boost/predef/compiler.h>
- The macro:
#if BOOST_COMP_GNUC // GCC specific #endif