r/cpp • u/Xaneris47 • Jun 10 '26
C++26: Cleaning up string literals
https://www.sandordargo.com/blog/2026/06/10/cpp26-string-literals-cleaned-up
97
Upvotes
r/cpp • u/Xaneris47 • Jun 10 '26
26
u/ABlockInTheChain Jun 11 '26
I wish they would fix the
char8_tdisaster.Either add all the required overloads for every applicable standard function so that I can actually use
char8_twithout casting, or else restore the ability create utf8-encodedstd::stringandstd::string_viewliterals which was present in C++17 but removed in C++20 (without-fno-char8_t).11
u/Tringi github.com/tringi Jun 10 '26
A little more sanity in the language is always welcome.
5
u/SupermanLeRetour Jun 10 '26
Interesting, thanks. I don't know why but I love those blog posts about niche aspects of the language.
4
u/johannes1971 Jun 11 '26
It does? I'm saving all my source files as utf8 (without BOM), and there are non-ascii characters around in places, but they all come out fine. What encoding would you have to use to make this not work?
3
u/chibuku_chauya Jun 11 '26
It used to be undefined behaviour to not terminate a string or character literal with a closing quote. Is that still the case?
1
u/trad_emark Jun 11 '26
can you provide some more examples with multicharacter literals? an example of how to use it? i have never seen anything like that before and i would have swear that it was ill-formed.