Programming Tips - C/C++: What are the most useful predefined macros?

Date: 2010apr5 Update: 2026oct2 Language: C/C++ Q. C/C++: What are the most useful predefined macros? A. For me, these are:
#if defined(_WIN32) || defined(_WIN64) // Windows #else // Non-Windows (eg Unix) #fi #ifdef _MSC_VER // Microsoft Visual C++ specific stuff #endif #ifdef __GNUC__ // Using gcc (probably Linux) #endif #ifdef _MFC_VER // This only works with MFC (Microsoft Foundation Class) #endif #ifdef __cplusplus // Make some classes #endif #ifdef __BORLANDC__ // Borland C++ specific stuff #endif