union.sizeof
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Mar 25 22:09:15 PDT 2017
zabruk70 wrote:
> Thank you ag0aep6g and ketmar!!
>
> I will use additional outside align.
> I want packing inside, you are right.
> But i check result size with assert() and failed.
>
> But for clearness...
> I was thinked, that align not changes SIZE, but changes LOCATION.
> I was thinked, that "align(X) union Union1"
> just force compiler to place Union1 on boundaries of X bytes...
most of the time either location or padding will work the same. ;-)
but no, the idea of aligning is that structs/unions/etc. that comes
together one after another are aligned from the starting offset of the
first element, not from "address zero" for the whole app.
More information about the Digitalmars-d-learn
mailing list