user6795571 user6795571 - 3 years ago 423
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 ?

Answer Source

The definition is __cplusplus.

#ifdef __cplusplus 
// treated as C++ code
// treated as C code
#endif // __cplusplus
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download