@amonakov@mastodon.gamedev.place
@siguza@infosec.space @jann@infosec.exchange unfortunately it's even worse if you're concerned with conformance, because the definition of offsetof states:
The type and member designator shall be such that given
static type t;
then the expression &(t.member-designator) evaluates to an address constant.
which completely rules out offsetof(foo, arr[N]) when N is not a compile-time constant, and admits only zero for a constant N.
@cr1901@mastodon.social
@amonakov@mastodon.gamedev.place @siguza@infosec.space @jann@infosec.exchange (Found this by chance). I feel like I must be missing some context, because max(offsetof(struct foo, arr[0]), sizeof(struct foo)) doesn't return "0" for me?
https://godbolt.org/z/ror4KP3sc