c++ - Can __cplusplus ever be defined and equal to zero? -
this question has answer here:
the question came of whether 1 should wrap extern "c"
using #if
or #ifdef
. i.e.:
#if __cplusplus extern "c" { #endif
or
#ifdef __cplusplus extern "c" { #endif
which begs question: there ever situation __cplusplus defined equal zero?
according standard, __cplusplus
macro must defined, exact definition depends on c++ standard being used not zero.
for example, c++11 must 201103l
, note "it intended future versions of standard replace value of macro greater value."
historically, in ancient non-conforming compilers dig up, __cplusplus
defined 0 indicate non-conformance standard. of historical interest.
see: how __cplusplus directive defined in various compilers?
Comments
Post a Comment