HaggarTheHorrible
HaggarTheHorrible

Reputation: 7403

C: How to conditionally compile certain parts of code based on Compiler Type?

I would like to conditionally compile certain parts of code based on Compiler Type is there any macro for that?

Like this:

#if defined (COMPILER_TYPE e.g. GCC)
// Compile this
#elif defined (COMPILER_TYPE e.g. Visual Studio C Compiler)
// Else this
#endif

Thank you

Upvotes: 0

Views: 313

Answers (1)

user1233508
user1233508

Reputation:

You can check if these macros are defined, __GNUC__ for GCC and _MSC_VER for MSVC.

Upvotes: 2

Related Questions