digitalmars.D - Struct alignment
- Johan Engelen (30/30) Sep 24 2017 DMD <= 2.074 and DMD >= 2.075 disagree on struct alignment.
- EntangledQuanta (4/34) Sep 24 2017 Don't worry, this isn't a bug! It's a feature! It will just make
- kinke (3/4) Sep 24 2017 2.075+. ;)
- Johan Engelen (3/8) Sep 24 2017 Thanks kinke.
DMD <= 2.074 and DMD >= 2.075 disagree on struct alignment. ``` struct UInt { align(1): uint a; } struct Bug { ubyte one; UInt two; } static assert(Bug.two.offsetof == 4); // Error DMD>=2.075, 1 == 4 is false static assert(Bug.sizeof == 8); // Error DMD>=2.075, 5 == 8 is false align(1) struct Align1UInt { align(1): uint a; } struct BugAlign1 { ubyte one; Align1UInt two; } static assert(BugAlign1.two.offsetof == 1); static assert(BugAlign1.sizeof == 5); // Error DMD<=2.074, 8 == 5 is false ``` So... what's correct? :-) Cheers, Johan
Sep 24 2017
On Sunday, 24 September 2017 at 21:01:06 UTC, Johan Engelen wrote:DMD <= 2.074 and DMD >= 2.075 disagree on struct alignment. ``` struct UInt { align(1): uint a; } struct Bug { ubyte one; UInt two; } static assert(Bug.two.offsetof == 4); // Error DMD>=2.075, 1 == 4 is false static assert(Bug.sizeof == 8); // Error DMD>=2.075, 5 == 8 is false align(1) struct Align1UInt { align(1): uint a; } struct BugAlign1 { ubyte one; Align1UInt two; } static assert(BugAlign1.two.offsetof == 1); static assert(BugAlign1.sizeof == 5); // Error DMD<=2.074, 8 == 5 is false ``` So... what's correct? :-) Cheers, JohanDon't worry, this isn't a bug! It's a feature! It will just make your programs run faster! It won't get fixed! Don't want to break backwards compatibility, do we?
Sep 24 2017
On Sunday, 24 September 2017 at 21:01:06 UTC, Johan Engelen wrote:So... what's correct? :-)2.075+. ;) See https://github.com/dlang/dmd/pull/6754.
Sep 24 2017
On Sunday, 24 September 2017 at 21:21:27 UTC, kinke wrote:On Sunday, 24 September 2017 at 21:01:06 UTC, Johan Engelen wrote:Thanks kinke. (now on to fix LDC's codegen ;-)So... what's correct? :-)2.075+. ;) See https://github.com/dlang/dmd/pull/6754.
Sep 24 2017