Use Case: Check Compiler Setting Check Compiler Setting
#ifndef __cplusplus #error C++ is required #elif __cplusplus > 199711L // C++11 (or newer) code goes here #else // old-school code goes here #endif
If a compiler was released between C++ standards,
__cplusplus might differ
from the ones in the above table.
However, you can always rely on the fact that
the value of
__cplusplus for a newer standard
will be strictly larger than that of the previous standard.