This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 114b. See for the official list.


626. Preprocessor string literals

Section: 15.6.3  [cpp.stringize]     Status: CD2     Submitter: Gennaro Prota     Date: 12 September 2006

[Voted into WP at October, 2009 meeting.]

Clause 15 [cpp] refers in several places to “character string literals” without specifying whether they are narrow or wide strings. For instance, what kind of string does the # operator (15.6.3 [cpp.stringize]) produce?

15.7 [cpp.line] paragraph 1 says,

The string literal of a #line directive, if present, shall be a character string literal.

Is “character string literal” intended to mean a narrow string literal? (Also, there is no string-literal mentioned in the grammatical descriptions of #line; paragraph 4 reads,

which is apparently intended to suggest a string literal but does not use the term.)

15.11 [cpp.predefined] should also specify what kind of character string literals are produced by the various string-valued predefined macros.

Notes from the July, 2007 meeting:

The CWG affirmed that all the string literals mentioned in Clause 15 [cpp] are intended to be narrow strings.

Proposed resolution (September, 2008)

  1. Change the footnote in Clause 15 [cpp] paragraph 1 as follows:

  2. Thus, preprocessing directives are commonly called “lines.” These “lines” have no other syntactic significance, as all white space is equivalent except in certain situations during preprocessing (see the # character string literal creation operator in 15.6.3 [cpp.stringize], for example).
  3. Change 15.6.3 [cpp.stringize] paragraph 2 as follows:

  4. If, in the replacement list, a parameter is immediately preceded by a # preprocessing token, both are replaced by a single character ordinary string literal (5.13.5 [lex.string]) preprocessing token that contains the spelling of the preprocessing token sequence for the corresponding argument... Otherwise, the original spelling of each preprocessing token in the argument is retained in the character ordinary string literal, except for special handling for producing the spelling of string literals and character literals: a \ character is inserted before each " and \ character of a character literal or string literal (including the delimiting " characters). If the replacement that results is not a valid character ordinary string literal, the behavior is undefined. The character ordinary string literal corresponding to an empty argument is "". The order of evaluation of # and ## operators is unspecified.
  5. Change 15.6.6 [cpp.scope] paragraph 6 as follows:

  6. To illustrate the rules for creating character ordinary string literals and concatenating tokens, the sequence... or, after concatenation of the character ordinary string literals...
  7. Change 15.7 [cpp.line] paragraph 1 as follows:

  8. The string literal of a #line directive, if present, shall be a character an ordinary string literal.
  9. Change 15.7 [cpp.line] paragraph 4 as follows:

  10. ...and changes the presumed name of the source file to be the contents of the character ordinary string literal.
  11. Change 15.11 [cpp.predefined] paragraph 1 as follows:

  12. __DATE__




Notes from the September, 2008 meeting:

The proposed resolution will be discussed with the C Committee before proceeding, as it is expected that the next revision of the C Standard will also adopt new forms of string literals.

Additional notes (May, 2009):

At its most recent meeting, the C Committee decided to keep the existing term, “character string literal.”

One possibility for maintaining compatible phraseology with the C Standard would be to replace the occurrences of “ordinary string literal” in 5.13.5 [lex.string] with “character string literal,” instead of the extensive set of changes above.

Another possibility would be to leave the references in Clause 15 [cpp] unchanged and just insert a prefatory comment near the beginning that every occurrence of “character string literal” refers to a string-literal with no prefix. (The use of “ordinary string literal” in the preceding edits is problematic in that the phrase includes raw string literals as well as unprefixed literals.)

Proposed resolution (July, 2009):

  1. Change 15.6.3 [cpp.stringize] paragraph 2 as follows:

  2. A character string literal is a string-literal with no prefix. If, in the replacement list, a parameter is immediately preceded by a # preprocessing token...
  3. Change the fifteenth bullet of Annex Clause Annex B [implimits] paragraph 2 as follows: