C++ Logo


Advanced search

Re: [SG16] On whitespaces and new-line

From: Steve Downey <sdowney_at_[hidden]>
Date: Thu, 25 Mar 2021 16:46:34 -0400
On Thu, Mar 25, 2021 at 4:34 PM Tom Honermann <tom_at_[hidden]> wrote:

> There are two CWG issues related to this:
> - CWG #1655: Line endings in raw string literals
> <https://wg21.link/cwg1655>
> It looks like the current text addresses this. From 1655 "Is it intended
that, for example, a CRLF in the source of a raw string literal is to be
represented as a newline character or as the original characters?"
>From the current draft: http://eel.is/c++draft/lex.string#4
[*Note 2 <http://eel.is/c++draft/full#lex.string-note-2>*:
A source-file new-line in a raw string literal results in a new-line in the
resulting execution string literal.

Assuming no whitespace at the beginning of lines in the following example,
the assert will succeed:const char* p = R"(a\ b c)"; assert(std::strcmp(p,
"a\\\nb\nc") == 0);
— *end note*]

Received on 2021-03-25 15:46:48