In accordance with the standard, the __cplusplus macro must be defined, the exact definition depends on the C ++ standard used, but it will not be zero.
For example, for C ++ 11 it should be 201103L , with the note "It is assumed that future versions of this standard will replace the value of this macro with a larger value."
Historically, in some ancient non-compliant compilers that you could possibly dig, __cplusplus was defined as 0 to indicate non-compliance with the standard. This is of historical interest only.
See: How is the __cplusplus directive defined in different compilers?
source share