Namespaces
Variants
Views
Actions

Talk:cpp/language/escape

From cppreference.com

[edit] examples for valid and invalid escape sequences

I'd like to add some examples, e.g. for \x sequences, how they go longer than expected and how to avoid this by splitting the string literal etc.

Perhaps the table should make more clear, that \x sequences are not limited to exactly 2 hex digits following. --62.224.166.63 02:32, 15 December 2015 (PST)

"2 hex digits" is not true. The text of the page already says "Hexadecimal escape sequences have no length limit and terminate at the first character that is not a valid hexadecimal digit. If the value represented by a single hexadecimal escape sequence does not fit the range of values represented by the character type used in this string literal (char, char16_t, char32_t, or wchar_t), the result is unspecified." --Cubbi (talk) 02:58, 15 December 2015 (PST)

[edit] can I repalce printf with cout?

In other codes,usually it is cout.

Yes. Though, it's done. Good point.) --Space Mission (talk) 22:06, 2 July 2020 (PDT)

[edit] The case of `\{`

Is the \{ escape sequence valid? An example: std::string a= "\{anna}";

Looks at page. No... --Ybab321 (talk) 10:54, 1 March 2023 (PST)