[Issue 2278] Guarantee alignment of stack-allocated variables on x86
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Jul 24 06:02:30 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=2278
bearophile_hugs at eml.cc changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |bearophile_hugs at eml.cc
--- Comment #10 from bearophile_hugs at eml.cc 2012-07-24 06:02:27 PDT ---
In DMD 2.060beta this problem seems partially solved, for structs:
import core.stdc.stdio: printf;
align(16) struct Foo { ubyte u; }
// struct Foo { ubyte u; } // try this
void main() {
Foo f1;
ubyte[3] b1;
Foo f2;
ubyte[5] b2;
Foo f3;
ubyte[7] b3;
short s1;
Foo f4;
printf("%u\n", cast(size_t)&f1 % 16);
printf("%u\n", cast(size_t)&f2 % 16);
printf("%u\n", cast(size_t)&f3 % 16);
printf("%u\n", cast(size_t)&f4 % 16);
}
Output:
0
0
0
0
But this syntax is not supported yet:
void main() {
align(16) ubyte u;
}
--
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