Let's say we have the following:
\u0052\
\u0022\u0058(Please no?)\u0058\u0022
After converting universal character names and performing line splicing, the result will be
R"X(Please no?)X"
Which is a valid raw string. According to 2.5.3, "Between the initial and final double quote characters of the raw string, any transformations performed in phases 1 and 2 are reverted":
R"\u0058(Please no?)\u0058"
Which is still a valid raw string.
Is this really how the process operates? If not, how much must be changed to make the above a valid raw string?
No, that's not how the process works.
Section 2.3, paragraph 2:
... if the hexadecimal value for a universal-character-name outside the c-char-sequence, s-char-sequence, or r-char-sequence of a character or string literal corresponds to a control character ... or to a character in the basic source character set, the program is ill-formed.
So your program is ill-formed. Some compilers may choose to resolve the universal-character-names in the way you indicate, but that would be a non-standard extension.
Other than that, you've got it right. If you wrote:
R\
"\u0058(Please no?)\u0058"
The \u0058's would be reverted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With