C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Ensure ABI compatibility at runtime -- std::layout_of

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Thu, 7 Nov 2024 14:51:02 +0000
On Thu, Nov 7, 2024 at 1:46 PM Lauri Vasama wrote:
>
> What if the types remain the same but their meaning changes?
>
> Let's say you have a hash table where the capacity is stored in size_t.
> Later the implementation is changed such that that same size_t stores
> capacity - 1, i.e. a bitmask used for fast modulo when the capacity is
> always a power of two. In this case the hash would not change, but ABI
> compatibility is still broken.


Yeah you're right it wouldn't be 100% reliable, but I think it would
be a great help in debugging modular programs that load in foreign
libraries.

What you've describe in the above though is a conscious ABI break.
Something like "std::layout_of" would be more for unintentional ABI
breaks.

Received on 2024-11-07 14:51:12