December 21, 2001 align doesn't work? | ||||
|---|---|---|---|---|
| ||||
D seems to ignore align() attribute. The following program should
print 12, but it outputs 6:
import stdio;
struct vector
{
align(4):
short x;
short y;
short z;
}
int main(char[][] args)
{
printf("%d\n", vector.size);
}
...or am I doing something wrong?
Also, could you please make it so that align() could be applied to structs & unions as well? Like this:
align(1) struct DIB_HEADER ...
Seems a bit more consistent when I want to define alignment for the entire structure, not its separate members.
| ||||
December 21, 2001 Re: align doesn't work? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to Pavel Minayev | I'll check it out. -Walter "Pavel Minayev" <evilone@omen.ru> wrote in message news:9vvrti$1g3d$2@digitaldaemon.com... > D seems to ignore align() attribute. The following program should > print 12, but it outputs 6: > > import stdio; > > struct vector > { > align(4): > short x; > short y; > short z; > } > > int main(char[][] args) > { > printf("%d\n", vector.size); > } > > ...or am I doing something wrong? > > Also, could you please make it so that align() could be applied to structs & unions as well? Like this: > > align(1) struct DIB_HEADER ... > > Seems a bit more consistent when I want to define alignment for the entire structure, not its separate members. > > | |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply