Mail Archives: djgpp/2002/06/27/11:15:15
Alex Yeryomin (AYeryomin AT excelsior-usa DOT com) wrote:
: Hello,
: I can't find in FAQ (sorry, maybe I missed it), how to align struct
: members under gcc/DJGPP? What is pragma/option doing this? Is there
: some way to specify the alignment only for some piece of code like
: this:
: <- set alignment by 1 byte here to pack all members altogether. how?
: struct zzz
: {
: ...
: };
: <- reset alignment to default. how?
If C, make that:
struct zzz
{
...
} __attribute__((packed));
or something very similar.
It's been reported that that doesn't work properly in C++ and for that
you should use:
struct zzz
{
... __attribute__((packed));
... __attribute__((packed));
};
: Is it possible to align also data object (variables) into the memory?
: F.e., all variables should be alignment by the paragraph 16 bytes.
: How?
Not sure, but perhaps:
int my_int __attribute__((align(16)));
or something like that does the trick. But remember that the section
must be aligned to this as well (a link issue).
Right,
MartinS
- Raw text -