Title
Adding spaces between tokens in stringizing
Status
open
Section
15.6.3 [cpp.stringize]
Submitter
Chandler Carruth

Created on 2013-02-18.00:00:00 last changed 133 months ago

Messages

Date: 2013-04-15.00:00:00

Notes from the April, 2013 meeting:

Because the preprocessor specification is primarily copied directly from the C Standard, this issue has been referred to the C liaison for consultation with WG14.

Date: 2022-02-18.07:47:23

Given the following input,

  #define F(A, B, C) A ## x.B ## y.C ## z
  #define STRINGIFY(x) #x
  #define EXPAND_AND_STRINGIFY(x) STRINGIFY(x)
  char v[] = EXPAND_AND_STRINGIFY(F(a, b, c))

there is implementation variance in the value of v: some produce the string "ax.by.cz" and others produce the string "ax. by. cz". Although 15.6.3 [cpp.stringize] paragraph 2 is explicit in its treatment of leading and trailing white space, it is not clear whether there is latitude for inserting spaces between tokens, as some implementations do, since the description otherwise is written solely in terms of preprocessing tokens. There may be cases in which such spaces would be needed to preserve the original tokenization, but it is not clear whether the result of stringization needs to produce something that would lex to the same tokens.

See also issue 2522.

History
Date User Action Args
2013-05-03 00:00:00adminsetmessages: + msg4363
2013-02-18 00:00:00admincreate