Re: wrong struct alignment

2015-07-01 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 1 July 2015 at 20:01:08 UTC, dd0s wrote: intscope_id; // 4 short port; // 8 // -- this is 4 bytes instead of 2 That's expected because scope_id takes 4 bytes, so port has to be at 8 so it doesn't overlap the preceding int. The extra two bytes you see in sizeof

wrong struct alignment

2015-07-01 Thread dd0s via Digitalmars-d-learn
i have the following struct, and i expect it to have 30 bytes but sizeof tells me it has 32 bytes. dmd seems to still use 4byte alignment altough i specified to align 2bytes. struct netadr_t { align(2): inttype; // 0 intscope_id; // 4 short port; // 8 // -- this is

Re: wrong struct alignment

2015-07-01 Thread anonymous via Digitalmars-d-learn
On Wednesday, 1 July 2015 at 20:01:08 UTC, dd0s wrote: i have the following struct, and i expect it to have 30 bytes but sizeof tells me it has 32 bytes. dmd seems to still use 4byte alignment altough i specified to align 2bytes. struct netadr_t { align(2): inttype; // 0

Re: wrong struct alignment

2015-07-01 Thread dd0s via Digitalmars-d-learn
thank you both, indeed missed that truncation step