views:

164

answers:

1

I'm trying to detect the compiler used to compile my source code. I can easily find predefined macros to check for MSVC or GCC (see http://predef.sourceforge.net/ for example), but I cannot find any macro to check for clang.

Does someone know if clang defines a macro like __CLANG__ in order to know what is currently compiling my code ?

+3  A: 

Found the answer using strings + grep :

$ strings /usr/bin/clang | grep __ | grep -i clang
__clang__
Pierre Bourdon