C++ Logo

std-proposals

Advanced search

Re: [std-proposals] [[packed]]

From: Frederick Virchanza Gotham <cauldwell.thomas_at_[hidden]>
Date: Wed, 6 Dec 2023 17:01:06 +0000
On Wed, Dec 6, 2023 at 4:52 PM Gašper Ažman wrote:
>
> ++ for unaligned<trivial>


So how would "std::unaligned<Trivial>" work? Would it lack tail
padding? Or would it lack tail padding and also lack padding between
members?

So if I have a trivial standard-layout struct as follows:

    struct Monkey {
        long unsigned a;
        char b;
        // padding here?
        long double c;
        char d;
        // padding here?
        float e;
        char f;
        // padding here?
    };

Then what will std::unaligned<Monkey> do? Will it take out just the
tail padding, or will it take out the 3 pieces of padding?

Received on 2023-12-06 17:01:19