C++ Logo

std-proposals

Advanced search

Re: Avoid copies when using string_view with APIs expecting null terminated strings

From: Tom Mason <wheybags_at_[hidden]>
Date: Tue, 29 Dec 2020 00:52:51 +0000
Ok, it seems I misunderstood, and this wouldn't be possible without breaking current default compatability. I hadn't noticed the -fabi-compat-version option defaulting to provide gcc 7 compatability in a way that wouldn't work for this change. Given that, I think this should maybe be done in a separate class.

On Sun, Dec 27, 2020, at 1:02 PM, Thiago Macieira via Std-Proposals wrote:
> On Sunday, 27 December 2020 05:34:55 -03 Nikolay Mihaylov via Std-Proposals
> wrote:
> > ... the point is...
> > stealing bits from pointer is not portable, even between compilers. I know
> > it can be done for x64 and probably Arm 64, but for Arm32 or 32 bit Intel -
> > I am not sure.
>
> That is QoI. We don't need to discuss *how* an implementation will do it. The
> standard only concerns itself with behaviour.
>
> My point is only that there are ways, some better than others, but none of
> them have zero cost. And that is the crux of the issue, even if the ABI were
> not a concern. The cost/benefit ratio needs to be justified, because it's
> something all users of string_view would need to pay.
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Software Architect - Intel DPG Cloud Engineering
>
>
>
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals
>

Received on 2020-12-28 18:53:36