C++ Logo

std-proposals

Advanced search

Re: [std-proposals] A better std::byte type

From: Alejandro Colomar <une+cxx_std-proposals_at_[hidden]>
Date: Fri, 26 Jun 2026 15:25:41 +0200
Hi Jonathan,

On 2026-06-26T13:23:15+0100, Jonathan Wakely wrote:
> > In many decades, that could happen. After all, void* replaced char*
> > back in the days.
>
> There was a lot less code out in the world then, and no ISO standard
> that people had followed.
>
> >
> > If the new _Byte* had implicit conversions like void*, and we had C's
>
> We're talking about C++ here. So calling it _Byte is silly, we're not
> talking about C.

I called it _Byte because std::byte (and thus byte) is already taken.
You may want to call it the_new_byte, but that'd also be silly, IMO.

> And void* does not have implicit conversions.

One can still convert implicitly from anything to void* in C++ (IIRC);
it's stricter than C, but it still has some implicit conversions.
I expect if we had a C/C++ _Byte type, it would have the same conversion
rules that void* has, and that would mean that in C++ you'd have one-way
implicit conversions.

> If you want to talk about some hypothetical other proposal for C,
> please make that clear instead of just trying to impose your world
> view on a thread about a C++ proposal.

I'm not imposing anything. Did my message look like trying to impose
something?

On the other hand, a proposal about a new type for handling raw bytes
--and thus, have the special aliasing rules that are currently reserved
for character types-- would certainly do good in caring about
C compatibility.


Have a lovely day!
Alex

-- 
<https://www.alejandro-colomar.es>

Received on 2026-06-26 13:25:49