C++ Logo

std-proposals

Advanced search

Re: Proposal - Allow any character between double quotes for strings.

From: Domen Vrankar <domen.vrankar_at_[hidden]>
Date: Thu, 5 Mar 2020 07:32:18 +0100
On Thu, Mar 5, 2020, 1:27 AM J Decker via Std-Proposals <
std-proposals_at_[hidden]> wrote:

>
> There's (IMO) not a lot of reason to terminate a string because end of
> line characters are encountered...
>

Backward compatibility and the fact that std C functions expect it?

You should use std::string_view or std:: string APIs for such cases.

https://gist.github.com/d3x0r/32a48432660968fa249899e934c841e1
>
> Allow any character other than a " in quoted strings. The " character
> itself needs to be escaped \" if included in " to a closing ". All
> regular escape handling can be done, but other literal characters like
> '\t' or '\n' that are in the source between quotes should be included as
> that literal character.
>

See raw C++ string literals. The were introduced in C++11 and should cover
your use cases.

Regards,
Domen

J
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2020-03-05 00:35:16