
On 26 Sep 2025 15:24, Peter Dimov via Boost wrote:
Julien Blanc wrote:
Le 2025-09-26 12:31, Peter Dimov via Boost a écrit :
The idea that we're somehow delivering enormous value by making it clear that the parameter is not a pointer to a single `char` is misguided; pointers to a single `char` are so rare that a `char const*` is essentially an idiomatic way to denote a null terminated char sequence. Its downside is not lack of type safety.
Alas `char const*` is also an idiomatic way to point at a bunch of raw bytes, whose size is given elsewhere, and clearly are not null terminated.
Common (unfortunately), maybe. Idiomatic... maybe not so much. :-)
I'd say using uint8_t or unsigned char for raw bytes is more common and idiomatic. Well, there's also std::byte but that came way too late to the party, so is basically useless.