B
borophyll
GCC allows you to define macros called "new" and "delete" in the
preprocessor phase. This seems to be in violation of the C++ spec, in
particular the rules for the creation of preprocessing tokens.
Section 2.4 of ISO/IEC 14882:2003 states that preprocessing tokens
belong to one of the following groups
preprocessing-token:
header-name
identifier
pp-number
character-literal
string-literal
preprocessing-op-or-punc
each non-white-space character that cannot be one of the
above
Section 2.12 defines a preprocessing-op-or-punc to be:
preprocessing-op-or-punc: one of
{ } [ ] # ## ( )
<: :> <% %> %: %:%: ; : ...
new delete ? :: . .*
+ - * / % ˆ & | ̃
! = < > += -= *= /= %=
ˆ= &= |= << >> >>= <<= == !=
<= >= && || ++ -- , ->* ->
and and_eq bitand bitor compl not not_eq
or or_eq xor xor_eq
Since "new" and "delete" are preprocessing-op-or-punc's, does this not
violate the spec?
Regards
B.
preprocessor phase. This seems to be in violation of the C++ spec, in
particular the rules for the creation of preprocessing tokens.
Section 2.4 of ISO/IEC 14882:2003 states that preprocessing tokens
belong to one of the following groups
preprocessing-token:
header-name
identifier
pp-number
character-literal
string-literal
preprocessing-op-or-punc
each non-white-space character that cannot be one of the
above
Section 2.12 defines a preprocessing-op-or-punc to be:
preprocessing-op-or-punc: one of
{ } [ ] # ## ( )
<: :> <% %> %: %:%: ; : ...
new delete ? :: . .*
+ - * / % ˆ & | ̃
! = < > += -= *= /= %=
ˆ= &= |= << >> >>= <<= == !=
<= >= && || ++ -- , ->* ->
and and_eq bitand bitor compl not not_eq
or or_eq xor xor_eq
Since "new" and "delete" are preprocessing-op-or-punc's, does this not
violate the spec?
Regards
B.