On Thu, 1 Jun 2023 19:25:38 GMT, Jorn Vernee <jver...@openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/foreign/MemoryLayout.java line 645: >> >>> 643: * is 1. As such, regardless of its size, in the absence of an >>> {@linkplain #withByteAlignment(long) explicit} >>> 644: * alignment constraint, a padding layout does not affect the >>> alignment constraint of the group or sequence layout >>> 645: * it is nested into. >> >> It is possible to override the alignment constraints of group and sequence >> layouts, so maybe this should say _natural alignment_. >> Suggestion: >> >> * alignment constraint, a padding layout does not affect the natural >> alignment of the group or sequence layout >> * it is nested into. > > On a related note: should we even allow sequences of padding layouts? I let sequence of padding slide on the basis that groups of padding are allowed. But it's a somewhat arbitrary line. That said, we do use stuff like that in jextract, where we model types we don't support (or bitfields) as padding. I think starting to ban padding in certain places would result in a less compositional API - and perhaps tools would have to workaround some of these limitations. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14098#discussion_r1213672976