logoalt Hacker News

nlytoday at 9:33 AM2 repliesview on HN

__attribute__((may_alias, packed)) right on the struct.


Replies

amlutotoday at 2:50 PM

Check your generated code. Most compilers assume that packed also means unaligned and will generate unaligned load and store sequences, which are large, slow, and may lose whatever atomicity properties they might have had.

johannes1234321today at 9:52 AM

That is not C, but a non-standard extension and thus not portable.

show 1 reply