[luatex] fio library byte order

Martin Mareš mj at ucw.cz
Mon Jun 22 10:52:30 CEST 2020


Hello!

> Type punning is undefined behaviour.  When you read from a different
> union member than you wrote to, there is no guarantee that you are
> actually reading the same memory.

I beg to disagree.  Generally, type punning causes undefined behavior,
but there is a couple of specific cases explicitly allowed by the standard.

According to paragraph 6.5.7 of the C11 standard:

(1) A union containing a member of type T can be accessed as type T directly
    (this also implies that union padding can be inserted only after the
    members, not before).

(2) Any object can be accessed as (signed or unsigned) chars.

				Have a nice fortnight
-- 
Martin `MJ' Mareš                        <mj at ucw.cz>   http://mj.ucw.cz/
United Computer Wizards, Prague, Czech Republic, Europe, Earth, Universe
Hex dump:  Where witches put used curses...


More information about the luatex mailing list.