On Fri, 2 Dec 2022 20:21:17 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
>> src/java.base/share/classes/java/lang/foreign/VaList.java line 55: >> >>> 53: * and any other type that fits into a {@code long}. >>> 54: * <h2 id="safety">Safety considerations</h2> >>> 55: * Accessing a value through a variable argument list using the wrong >>> memory layout will result in undefined behavior. >> >> Note that I went with "through" here, instead of "in", since we describe a >> va list as a "stateful cursor used to iterate over a set of arguments" in >> the section before this. > > I think we can condense this: > > > For instance, if a variable argument list currently points at a C {@code > int} value, then accessing it using > * {@link #nextVarg(ValueLayout.OfLong)} is illegal. Similarly, accessing the > variable argument list with {@link #skip(MemoryLayout...)}, and providing a > layout other than {@link ValueLayout.OfInt} is illegal. Any such illegal > accesses might not be detected by the implementation, and can corrupt the > variable argument list, so that the behavior of subsequent accesses is also > undefined. > ``` Done ------------- PR: https://git.openjdk.org/jdk/pull/11440