[foreign-memaccess] on endianness

Jorn Vernee jbvernee at xs4all.nl
Tue Jun 25 15:16:36 UTC 2019


Going with explicit endianness sounds good.

Tbh, I don't feel that strongly either way, and like you say, this also 
leaves the door open to add some default later.

Jorn

On 2019-06-20 19:08, Maurizio Cimadamore wrote:
> Hi,
> currently, the memory access prototype uses native endianness where
> not specified. I think that is slightly undesirable, as it makes
> things implicit (and against our design principles); this is
> particularly evident when interacting with byte buffers, which have
> BIG_ENDIAN by default.
> 
> So, I think we have a number of choices:
> 
> 1) endianness should always be explicit
> 2) allow implicit endianness  - but what is the default value?
>    a) BIG_ENDIAN, as for byte buffers (users will have less surprises?)
>    b) native, in name of simplifying interaction with native code
>    c) some magic NO_ENDIAN state, which will have to be set later
> (before memory access)
> 
> I'm currently (strongly) leaning for (1). This option is explicit, and
> correct, and leaves the door open to adding more convenient
> endianness-less defaults in the future. This choice would affect both
> the Layout API (e.g. ValueLayout factories) and the VarHandle
> combinators under MemoryAccessVarHandles.
> 
> Comments?
> 
> Maurizio


More information about the panama-dev mailing list