[Issue 8355] struct's sizeof has bug
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Jul 7 13:58:14 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8355
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bearophile_hugs at eml.cc
--- Comment #3 from bearophile_hugs at eml.cc 2012-07-07 13:58:13 PDT ---
(In reply to comment #2)
> If you're using head, you'll need to put the align(1) inside the struct
> declaration, rather than outside. The layout is now only affected by align
> attributes that are inside the declaration.
What's the right syntax? This prints three times 28:
struct Foo1 {
align(1):
ushort a,b,c,d,e;
uint f, g, h;
ushort i, j;
}
pragma(msg, Foo1.sizeof);
struct Foo2 {
align(1) {
ushort a,b,c,d,e;
uint f, g, h;
ushort i, j;
}
}
pragma(msg, Foo2.sizeof);
struct Foo3 {
align(1) ushort a,b,c,d,e;
align(1) uint f, g, h;
align(1) ushort i, j;
}
pragma(msg, Foo3.sizeof);
void main() {}
While this prints 26:
align(1) struct Foo4 {
align(1):
ushort a,b,c,d,e;
uint f, g, h;
ushort i, j;
}
pragma(msg, Foo4.sizeof);
void main() {}
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list