Re: Struct alignment vs alignment of fields

2014-08-09 Thread via Digitalmars-d-learn
On Friday, 8 August 2014 at 18:20:41 UTC, ketmar wrote: yeah, chars (and bytes, and so on) are not aligned. i.e. align(1) struct B { int qtim; int bid; int ofr; int bidsiz; int ofrsiz; short mode; char ex; byte mmid; char z; } has sizeof == 25. not sure if specs mentions

Re: Struct alignment vs alignment of fields

2014-08-08 Thread ketmar via Digitalmars-d-learn
p.s. seems that aligning works only on ints. i.e. on types which has sizeof = default platform align.

Re: Struct alignment vs alignment of fields

2014-08-08 Thread ketmar via Digitalmars-d-learn
yeah, chars (and bytes, and so on) are not aligned. i.e. align(1) struct B { int qtim; int bid; int ofr; int bidsiz; int ofrsiz; short mode; char ex; byte mmid; char z; } has sizeof == 25. not sure if specs mentions this, but they should.

Struct alignment vs alignment of fields

2014-08-07 Thread via Digitalmars-d-learn
(Original discussion: http://forum.dlang.org/thread/fckwpddiwxonabqaf...@forum.dlang.org#post-pskjgieddhpntzaokohj:40forum.dlang.org) align(1) struct A { align(1): int qtim; int bid; int ofr; int bidsiz; int ofrsiz; short mode;

Re: Struct alignment vs alignment of fields

2014-08-07 Thread Era Scarecrow via Digitalmars-d-learn
On Thursday, 7 August 2014 at 17:22:15 UTC, Marc Schütz wrote: (Original discussion: http://forum.dlang.org/thread/fckwpddiwxonabqaf...@forum.dlang.org#post-pskjgieddhpntzaokohj:40forum.dlang.org) I would expect `B` to have a gap between `ex` and `mmid`. AFAIK the outer `align(1)` only

Re: Struct alignment vs alignment of fields

2014-08-07 Thread Era Scarecrow via Digitalmars-d-learn
Still watching this, but the Dconf 2014 bare metal presentation gets into it a bit... http://youtu.be/qErXPomAWYI?t=37m20s