3 ms·
> This trick only works if the architecture supports unaligned memory access Presumably then it's relying on undefined behaviour.
by MaxBarraclough 5y ago
> This trick only works if the architecture supports unaligned memory access
Presumably then it's relying on undefined behaviour.
- stormbrew 5y agopretty sure it's just implementation defined. In the sense that the implementation defines the allowed alignment, if nothing else (ie. on x86 the allowed alignment is 1 byte even if that's not optimal).
- MaxBarraclough 5y agoI don't think so. What I can find on this topic with a quick search points to it being outright UB. https://stackoverflow.com/a/47622343/ https://stackoverflow.com/a/47622343/ https://stackoverflow.com/a/28895321/ https://stackoverflow.com/a/28895321/ https://blog.quarkslab.com/unaligned-accesses-in-cc-what-why-and-solutions-to-do-it-properly.html https://blog.quarkslab.com/unaligned-accesses-in-cc-what-why...