RFR: 8340205: Native linker allows MemoryLayout consisting of only PaddingLayout [v5]

Jorn Vernee jvernee at openjdk.org
Mon Oct 7 14:59:36 UTC 2024


On Mon, 7 Oct 2024 14:50:33 GMT, Vladimir Kozelkov <duke at openjdk.org> wrote:

> I don't really understand why unions should allow PaddingLayout inside themselves at all.

Padding inside unions is required for a case like this:


union Foo {
    long long x;
    int arr[3];
};


Size of the struct without padding is 12 bytes, but it needs 8-byte alignment, so it needs 16 bytes of padding.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/21041#issuecomment-2397166726


More information about the core-libs-dev mailing list