C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::sizeof_minus_trailing_padding

From: Thiago Macieira <thiago_at_[hidden]>
Date: Sun, 03 Dec 2023 19:14:28 -0800
On Sunday, 3 December 2023 18:51:05 PST Jason McKesson via Std-Proposals
wrote:
> So if "using NUA on arbitrary types is wrong", then the feature is
> fundamentally broken.

Yes.

And a kludge to work around it is that NUA is allowed to give the same address
to two different objects but not if they are of the same type.

But there's nothing that says my two unrelated empty types can't compare their
pointer addresses for some reason after casting to void*, like say for
inserting into an sorted container.

Therefore, I repeat: do not use NUA on arbitrary types.

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

Received on 2023-12-04 03:14:30