This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 116a. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.

2024-12-19


2540. Unspecified interpretation of numeric-escape-sequence

Section: 5.13.3  [lex.ccon]     Status: CD6     Submitter: Richard Smith     Date: 2022-02-25

[Accepted at the July, 2022 meeting.]

Subclause 5.13.3 [lex.ccon] does not specify how the characters in an octal-escape-sequence or hexadecimal-escape-sequence are interpreted to obtain the integer value v that is used in bullet 3.2:

Proposed resolution (approved by CWG 2022-03-11):

  1. Change in 5.13.3 [lex.ccon] bullet 3.2 as follows:
    • A character-literal with a c-char-sequence consisting of a single numeric-escape-sequence that specifies an integer value v has a value as follows:
      • Let v be the integer value represented by the octal number comprising the sequence of octal-digits in an octal-escape-sequence or by the hexadecimal number comprising the sequence of hexadecimal-digits in a hexadecimal-escape-sequence.
      • If v does not exceed the range of representable values of the character-literal's type, then the value is v.
      • ...
  2. Change in 5.13.5 [lex.string] bullet 10.2 as follows:
    • Each numeric-escape-sequence (5.13.3 [lex.ccon]) that specifies an integer value v contributes a single code unit with a value as follows:
      • Let v be the integer value represented by the octal number comprising the sequence of octal-digits in an octal-escape-sequence or by the hexadecimal number comprising the sequence of hexadecimal-digits in a hexadecimal-escape-sequence.
      • If v does not exceed the range of representable values of the string-literal's array element type, then the value is v.
      • ...