According to the standard, the __cplusplus
macro must be defined, the exact definition depends on the C++ standard being used but it will not be zero.
For example, for C++11 it must be 201103L
, with the note "It is intended that future versions of this standard will replace the value of this macro with a greater value."
Historically, in some ancient non-conforming compilers you could probably dig up, __cplusplus
was defined to 0 to indicate non-conformance with the standard. This is only of historical interest.
See: How are the __cplusplus directive defined in various compilers?