C++ Logo


Advanced search

Re: [std-proposals] Remove multi-character literal

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Thu, 7 Mar 2024 12:07:37 +0100
So one way to go forward would be to grep codebases for a regular expression of single quotes with more than one character inside to see how common the idiom is?   -----Ursprüngliche Nachricht----- Von:Lorand Szollosi via Std-Proposals <std-proposals_at_[hidden]> Gesendet:Do 07.03.2024 08:49 Betreff:Re: [std-proposals] Remove multi-character literal An:std-proposals_at_[hidden]; CC:Lorand Szollosi <szollosi.lorand_at_[hidden]>; Hi, It’s (been) relatively commonly used in template metaprogramming codes for compile-time strings, where you could write, instead of c_str<‘h’, ‘e’, ‘l’, ‘l’, ‘o’>, c_str<‘hell’, ‘o’> on 32-bit and c_str<‘hello’> on 64-bit architectures and have ABI-dependent result. Nowadays, it’s phased out by a properly written CSTR(“hello”) macro that uses compile-time strlen and indexing beneath the surface. Bests, -lorro > On 6 Mar 2024, at 22:45, veronica alphonso via Std-Proposals <std-proposals_at_[hidden]> wrote: > >  > Multi-character literals are unreliable to encode into an int because these depend on the implementation-defined size of int to know how many characters you can encode into, which in my opinion, is horrible. > > Also, multi-character literals are unnecessary, most codebases use wide, UTF-16 or UTF32 encodings to encode multi-character literals appropriately (yes, i know wchar_t is less than ideal, but lets ignore that for now). > > I don't think this feature serves any purpose nowadays, and the few codebases that may still use it should remove its support and get into the more reliable approaches, so this feature can be deprecated once and for all. > -- > Std-Proposals mailing list > Std-Proposals_at_[hidden] > https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2024-03-07 11:07:39