C++ Logo

std-proposals

Advanced search

Re: [std-proposals] hexadecimal-escape-sequence

From: Fraser Gordon <fraserjgordon+cpp_at_[hidden]>
Date: Thu, 26 Jan 2023 12:54:49 -0500
Thanks Tom & Jens, submitted with your proposed change:
https://github.com/cplusplus/CWG/issues/230

Fraser

On Thu, 26 Jan 2023 at 12:45, Tom Honermann via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> Ha! Despite it looking very much like I just copied and resent essentially
> the same thing Jens did two minutes earlier, I swear I didn't! :)
>
> Tom.
> On 1/26/23 12:44 PM, Tom Honermann via Std-Proposals wrote:
>
> On 1/26/23 12:23 PM, Fraser Gordon via Std-Proposals wrote:
>
> Hi folks,
>
> I was reading the [lex.ccon] section of the current draft and noticed an
> oddity in the hexadecimal-escape-sequence
> <https://eel.is/c++draft/lex.ccon#nt:hexadecimal-escape-sequence>
> production:
>
> *hexadecimal-escape-sequence:*
>
> \x *hexadecimal-digit-sequence*
> *hexadecimal-escape-sequence hexadecimal-digit*
> \x{ *simple-hexadecimal-digit-sequence* }
>
> The combination of the 2nd and 3rd rules seems to say that \x{20}20 should
> be parsed as a hex escape sequence (presumably representing u+2020). Octal
> doesn't have this issue as *octal-escape-sequence* doesn't have a
> recursive definition.
>
> I tried this on Godbolt. GCC and Clang interpret '\x{20}20' as a
> multicharacter literal and "\x{20}{20}" as the string " 20". MSVC and icc
> appear not to support \x{}.
>
> I'd guess this isn't intentional as it would defeat the purpose of having
> \x{} sequences? At least two implementations seem to agree.
>
> Good catch!
>
> I think we want:
>
> *hexadecimal-escape-sequence:*
> \x *hexadecimal-digit-sequencesimple-hexadecimal-digit-sequence *
> * hexadecimal-escape-sequence hexadecimal-digit*
> \x{ *simple-hexadecimal-digit-sequence* }
>
> Would you be so kind as to file a CWG issue at
> https://github.com/cplusplus/CWG?
>
> Tom.
>
>
> Fraser
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2023-01-26 17:55:02