David Laight wrote:
> IIRC something in the standard requires the result to be a compile time
> constant

You're right: "... which expands to an integer constant expression that
has type size_t, the value of which is the offset in bytes ...".

> I suspect uses like the above were not thought of when the standard
> was written!

If they allowed sizeof to be a run-time value for VLAs they would
probably allowed such use of offsetof if they thought of it ...

BTW, I read the standard in a hurry yesterday, member-designator is
later used in the text:

"... then the expression &(t.member-designator) evaluates to an address
constant."

Alex

Reply via email to