c++ - Conditional-Operator in Constant Expression -
i tried following code snippet msvc 10, works fine.
enum { foo = (sizeof(void*) == 8 ? 10 : 20) }; int main() { return foo; }
what know is: c++ standard (preferably c++98) allow me use conditional-operator in constant expression when operands constant expressions, or microsoft quirk/extension?
this valid , sensible standard c++.
the ternary conditional operator forms expression, , expression constant expression if operands are.
the standard reference c++11 5.19/2:
a conditional-expression core constant expression [...]
note 5.16, ternary conditional expressions 1 type of conditional-expressions. other types things 2 == 3
.
Comments
Post a Comment