C++ Logo


Advanced search

Re: [std-proposals] std::sizeof_minus_trailing_padding

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 03 Dec 2023 14:26:38 -0800
On Sunday, 3 December 2023 09:55:30 PST Frederick Virchanza Gotham via Std-
Proposals wrote:
> I didn't know about the existence of no_unique_address until a few
> days ago, and so now I'll be more careful with 'memset' and 'memcpy'.
> The whole idea of 'potentially-overlapping objects' is a bit mad and I
> would imagine that a few people were hesitant to bring it into C++.

You shouldn't need to be.

Some other code using NUA on your own types is wrong. One should only use NUA
for types that declare that they don't need unique addresses. There's no
property for this, therefore using NUA on arbitrary types is wrong.

Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
   Software Architect - Intel DCAI Cloud Engineering

Received on 2023-12-03 22:26:40