C++ Logo

std-proposals

Advanced search

Re: [std-proposals] std::sizeof_minus_trailing_padding

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Mon, 4 Dec 2023 22:47:35 +0000
On Mon, Dec 4, 2023 at 7:54 PM Arthur O'Dwyer wrote:
>
> And this is important, of course, because `OkayWithPacking::set` needs to know at the time it is compiled whether it's conceivable that `this->i` is misaligned or not.
> You can't just take a type that isn't okay-with-packing and forcibly pack it; that will simply cause a lot of bus errors inside `set`. The type needs to — this is a motif here — know how it is going to be used.


Not sure if you're addressing me here but anyway the class I wrote,
called 'array_compacted', used 'memcpy' to copy the data to suitably
aligned storage.

Received on 2023-12-04 22:47:48