C++ Logo

SG16

Advanced search

Subject: Re: Reinterpreting pointers of character types
From: Hubert Tong (hubert.reinterpretcast_at_[hidden])
Date: 2021-01-30 18:37:58


On Thu, Jan 28, 2021 at 1:57 PM Jens Maurer via SG16 <sg16_at_[hidden]>
wrote:

> On 28/01/2021 19.37, Corentin via SG16 wrote:
> >
> >
> > On Thu, Jan 28, 2021 at 7:22 PM Peter Brett <pbrett_at_[hidden] <mailto:
> pbrett_at_[hidden]>> wrote:
> >
> > I think the big problem here is trying to make it a template.____
> >
> > __ __
> >
> > Make it named. It’s literally not possible to use this correctly in
> generic code.
> >
> >
> > Question then is do we want to solve the issue for wchar_t?
> > Because having the name of the encoding in the function kinda precludes
> that - the sizeof(wchar_t) being platform dependant
>
> You only get away with char* -> char8_t* because "char" has special
> aliasing exceptions.
>
Yes, I don't think there's much to be concerned about with char8_t/char
cases in terms of run-time evaluation. I think you need to ask at least
Richard and Daveed about the constexpr case.

>
> You'll get the full set of aliasing concerns for
> wchar_t* -> char16_t* or char32_t*
>
>
> Jens
> --
> SG16 mailing list
> SG16_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/sg16
>



SG16 list run by sg16-owner@lists.isocpp.org