user6795571 user6795571 - 9 months ago 117
C Question

universal preprocessor define for C or C++?

my code can be compiled with C or C++ compilers.
I'd like to know which one is doing the compilation

is there preprocessor define to tell me this ?


The definition is __cplusplus.

#ifdef __cplusplus 
// treated as C++ code
// treated as C code
#endif // __cplusplus