This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: C++ alternative tokens in the preprocessor


"Martin v. Loewis" <martin@loewis.home.cs.tu-berlin.de> writes:

| > [lex.key]/2 says these alternative representations of operators are
| > reserved and shall not be used otherwise.  But then, keywords are
| > only meaningful after preprocessing (i.e., you can #define new and
| > delete), so this is a bit fuzzy.
| 
| It doesn't say they are keywords, as keywords are listed in Table 3.
| Given that they are explained in 2.5, I'd expect they behave like
| digraphs in all respects.
| 
| Another questions is which of
| 
| #define P(a,b) a##b
| P(method_,and)

Well-formed.

| P(and,=)
| 
| is well-formed; the footnote explicitly mentions that it is spelled
| "and" in stringification, and [cpp.stringize] mentions explicitly that
| the spelling is taken. [cpp.concat] says that the tokens are
| "concatenated", so I'm not sure whether this means that the original
| or the alternative token is concatenated - they are supposed to
| "behave the same" (quote from normative text).

Normative text says:
2.12/1:

  Each preprocessing-op-or-punc is converted to a single token in
  translation phase 7 (2.1).

Phase 7 happens only after phase 4 where preprocessing diretives are
executed.

-- Gaby
CodeSourcery, LLC                             http://www.codesourcery.com

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]