On Fri, 20 Sep 2024 10:32:18 GMT, Jorn Vernee <jver...@openjdk.org> wrote:

> > The javadoc of the `Linker` also states that:
> > > [A group layout] G does not contain padding other than what is strictly 
> > > required to align
> > > its non-padding layout elements, or to satisfy (2) [the size of {@code G} 
> > > is a multiple of its alignment constraint]
> > 
> > 
> > I believe it is the intent here to rule out empty groups, or groups that 
> > contain only padding. Should we address that here (as I believe that once 
> > we add more checks, we'll need more tweaks to make the various exception 
> > more uniform) ?
> 
> Empty structs are supported by GCC, and the size of such a struct is actually 
> 0 bytes in C (as opposed to C++): https://godbolt.org/z/hvoc88oE7 So they 
> should be allowed I think. (We don't currently reject them at least)

OK - but I still think that padding-only groups should still be rejected. They 
feel outside the boundary of what the javadoc says - and yet, one could 
construct an argument that the current javadoc doesn't explicitly disallow them.

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

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

Reply via email to