C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::sizeof_minus_trailing_padding

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Sun, 3 Dec 2023 23:56:54 +0100
Hi Breno, I can see the padding of base classes being used (without attribute) only for empty base classes. See https://godbolt.org/z/bnnohMGTv   What am I missing? Best, Sebastian   -----Ursprüngliche Nachricht----- Von:Breno Guimarães via Std-Proposals <std-proposals_at_[hidden]> Gesendet:So 03.12.2023 23:17 Betreff:Re: [std-proposals] std::sizeof_minus_trailing_padding An:Std-Proposals <std-proposals_at_[hidden]>; CC:Breno Guimarães <brenorg_at_[hidden]>; Yeah, the link only talks about empty base class optimization, but that happens with non empty too. It should've been called "padding optimization" or something.  Just derive a class with trailing padding and add a member that can fit in the padding and the padding will be reused. Em dom., 3 de dez. de 2023 18:48, Frederick Virchanza Gotham via Std-Proposals <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]> > escreveu: On Sun, Dec 3, 2023 at 7:20 PM Breno Guimarãeswrote: > > By the way, the no_unique_address annotation didn't bring the concept of overlapping objects. It already existed. > > https://en.cppreference.com/w/cpp/language/ebo But people haven't been memcpy'ing and memset'ing empty base classes for a few decades. Bringing it in for types where people would have historically been using 'memset' as a bulldozer for a few decades is a much bigger deal. -- Std-Proposals mailing list Std-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals -- Std-Proposals mailing list Std-Proposals_at_[hidden] https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2023-12-03 22:56:56