Hacker News new | ask | show | jobs
by MathMonkeyMan 529 days ago
Is that why some structs have "char reserved[16]" data members? I think I saw this in NGINX, though that might have been to allow module compatibility between the open source offering and the paid version.
1 comments

Yes, that slightly improves ABI flexibility, though the fact that callers can still access fields limits that.

An alternative is to make the only member `char opaque[16]` (IIRC some locale-related thing in glibc does this, also I think libpng went through a transition of some sort related to this?), but calculating the size can be difficult outside of trivial cases since you can't use sizeof/offsetof.