James Kanze <> writes:
>(Which is interesting in itself. Why didn't they just define a
>production for concatenating string literals?)
Possibly, this way, the C++ grammar can be written more simple.
Also, it makes clear, that the concatenation »"a" "b"« never
is a run-time operation.
In C++ expressions usually the »substitutivity of identity«
holds, i.e., »any subexpression can be replaced by any other
equal in value« as long as there are no run-time effects, so
{ return 2 + 3; }
is the same as
{ int const a( 2 ); return a + 3; }
But, one does not want
{ return "a" "b"; }
to be the same as
{ char const * const a( "a" ); return a "b"; }
So, possibly the concatenation of string /literals/ but not
string-valued /expressions/ does not fit into the general
»substitutivity of identity« rule for C++ operators.
»The phases of translation are spelled out to resolve
questions raised about the precedence of different parses.
Can a #define begin a comment? (No.) Is backslash/new-line
permitted within a trigraph? (No.) Must a comment be
contained within one #include file? (Yes.) And so on. 25
The Rationale on preprocessing (§6.10) discusses the
reasons for many of the decisions that shaped the
specification of the phases of translation.«
Rationale for International Standard - Programming Languages - C
Revision 2, 20 October 1999
The idea of a grammar rule for »"a" "b"« as a concatenation
operation reminds me of
http://www.research.att.com/~bs/whitespace98.pdf