Mail Archives: djgpp/2001/04/19/13:02:37
On 19 Apr 2001, at 13:47, echo 'Rudolf Polzer' wrote:
> pavenis AT lanet DOT lv <pavenis AT lanet DOT lv> wrote:
> > On 18 Apr 2001, at 20:32, echo 'Rudolf Polzer' wrote:
> >
> > No. It doesn't work for C++. So best I can currently suggest is to avoid
> > using broken -fpack-struct and use pair of #pragma pack(1) and
> > #pragma pack() where needed. This is better as You can pack only
> > those structures You really need.
>
> And they work then?
> AFAIK -fpack-struct and #pragma pack(1) are equivalent, so the bug
> should occur on both.
>
I suggest writting some simple examples and trying to compile to
assembler source (command line option -S) and browse code
generated by GCC. I think it is much faster way as asking it here
(somebody should do it for You to answer, and if there will be too
many questions there may be no answer at all).
I suggested to use
#pragma pack(1)
struct foo { ... };
#pragma pack()
Of course You can check whether it really puts structure members at
first available byte without alignment.
Andris
- Raw text -