@cr1901@mastodon.social
@amonakov@mastodon.gamedev.place @siguza@infosec.space @jann@infosec.exchange Yes, about that sentence. I didn't know that e.g. &foo.arr[3] doesn't evaluate to an address constant (feels like it should be allowed, unless the existence of that pointer runs afoul of the "one past the end" behavior).
But I'm not great w/ flexible array members anyway and mostly write C89 when I write C :P.
@siguza@infosec.space
@cr1901@mastodon.social @amonakov@mastodon.gamedev.place @jann@infosec.exchange
unless the existence of that pointer runs afoul of the "one past the end" behaviorThat's precisely the issue.
But I guess ultimately you could do:
max(offsetof(struct foo, arr[0]) + N * sizeof(((struct foo*)0)->arr[0]), sizeof(struct foo))
...right?