On Sunday, 7 October 2012 at 12:42:17 UTC, novice2 wrote:
and contain additional 2 trailing bytes
But, imho, this is "unproperly" to include something outside
struct in its size.
Strictly speaking, nothing special is included, just empty bytes
for optimization purposes. This behavior is sim
and contain additional 2 trailing bytes
But, imho, this is "unproperly" to include something outside
struct in its size.
Thanx again.
Code align(1) struct ... { align(1): ... }
rescue me and return pre 2.060 behaviour
On Sunday, 7 October 2012 at 10:45:40 UTC, novice2 wrote:
Thanx Maxim,
but what about
S2.sizeof (should be 6) = 8
S3.sizeof (should be 6) = 8
http://dpaste.dzfl.pl/57911897
Alignment attribute specifies members' alignment if it is inside
structure and structure alignment if it is placed out
Thanx Maxim,
but what about
S2.sizeof (should be 6) = 8
S3.sizeof (should be 6) = 8
http://dlang.org/changelog.html
Since 2.060 behavior of align outside aggregate was changed. This
explains the first example. Regarding the second one: "alignment
for the fields of an aggregate doesn't affect the alignment of
the aggregate itself" - from spec
http://dlang.org/attribute.html#a
btw GDC and LDC 2.060 produces same output as DMD 2.060 at
http://dpaste.dzfl.pl/
Some of my code broken in DMD 2.060.
I need packed struct without align to process data.
Is this bug or something changed in 2.060 ?
Code http://dpaste.dzfl.pl/212ca53b :
import std.stdio;
align(1) struct S1
{
char[2] c; //+0
uint u; //+2
}
struct S2
{
align(1):
char[2] c; //+0