Conversation
it's kindof annoying that there's no standard way to do the same as__attribute__((packed)) (or [[gnu::packed]])

either use extensions or unpack by hand member-by-member what could otherwise be a single read/memcpy
1
0
1
@navi Having to account for potential unaligned reads in the standard sounds annoying.
1
0
0

@chjara @navi yeah, given that the c standard tries to be able to run on a lot of unreasonable hardware, it can’t exactly prescribe unaligned access being something you can do (it’s surprisingly common that you can’t)

1
0
0
@charlotte @navi I'm pretty sure x86 is the only architecture that does unaligned accesses as efficiently as aligned accesses (in most cases).
1
0
0

@chjara @navi for integer instructions

for floating point or vector instructions you need Special unaligned instructions (which just so happen to be the same speed nowadays)

0
0
0