[foreign-memaccess] RFR: 8248487: Add static helpers to access segments [v3]
Maurizio Cimadamore
mcimadamore at openjdk.java.net
Tue Jun 30 21:56:27 UTC 2020
On Tue, 30 Jun 2020 21:11:26 GMT, Henry Jen <henryjen at openjdk.org> wrote:
>> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Update src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayouts.java
>>
>> Co-authored-by: Henry Jen <henryjen at ztune.net>
>
> src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryAccess.java line 57:
>
>> 56: /**
>> 57: * Read a char from given address and offset, with byte order set to {@link ByteOrder#LITTLE_ENDIAN}.
>> 58: * <p>
>
> While the code indicates this is a 16-bit char, I wonder if it's better to clarify the address should have UTF-16 char,
> or Java char or wchar_t. Just to make it clear that the address is expected to have UTF-16 encoding?
> Same comment applies to al [gs]etChar_[BL]E methods.
I think it's tricky - a Java `char` is not _exactly_ a single unicode code point; as written in the javadoc, a Java
char is a code _unit_ (which might be a code point, or half a code point), as per UTF16 encoding. I agree this needs
some clarification, just not sure 100% yet on what would be the best way to proceed.
-------------
PR: https://git.openjdk.java.net/panama-foreign/pull/221
More information about the panama-dev
mailing list