C++ Logo

std-proposals

Advanced search

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

From: Lorand Szollosi <szollosi.lorand_at_[hidden]>
Date: Thu, 7 Mar 2024 08:48:56 +0100
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

Received on 2024-03-07 07:49:09