offsetof(struct foo, last_member) + sizeof a[0].last_member;
Sure. If you know the exact declaration of a type and are willing to abandon any pretense to abstraction or maintainability.
You're already in that territory, if you need access to that number.
My point was that a compiler synthesizing an assignment operation for a POD-type probably uses a number other than sizeof(<type>) for the number of bytes to be copied.
Your construction only reaffirms that point.
No, a compiler is explicitly allowed to use sizeof(type).
Overwriting padding bytes is guaranteed to be safe.
Can you point to chapter and verse where either a C or a C++ standard insists that an implementation provide padding beyond the declared members of a free-standing struct or union?
C99, 6.2.6.1; a footnote says exactly that, even.
Segher