Mail Archives: djgpp/1996/12/11/19:32:17
In article <32A810D9 DOT 366E9B4E AT m-net DOT arbornet DOT org>, Rohit Jalan <rohitj AT m-net DOT arbornet DOT org> wrote:
>Hi !!
>
>Is it possible to stop gcc from padding structures ?
>
>Thnx.
>Rohit
><rohitj AT hotmail DOT com>
Hi All,
When using DEC C/C++ on Alpha work stations we could get
around padding problems by rearranging structures, for
example:
struct fred
{
short id;
char type[3];
int count;
};
(The byte map would be ssppcccpiiii where s=short, p=pad, c=char, i=int)
would be rewritten as:
struct fred
{
int count;
short id;
char type[3];
};
(The byte map would be iiiisscccppp where s=short, p=pad, c=char, i=int)
and then all the padding would move to the end of the structure
and to all intents and purposes be ignored. Is this the case with
gcc/gxx?
Admittedly, if this does work in gcc/gxx then it is only of use if you
have control over the data formats being used, difficult if interfacing
to 3rd party software/hardware.
Thanks in advance
John
________________________________________________________________
Parallax Solutions Ltd. Tel.: 01203 514522
Stonecourt, Fax.: 01203 514401
Siskin Drive, Web : http://www.parallax.co.uk/~johne
Coventry CV3 4FJ Mail: johne AT parallax DOT co DOT uk
________________________________________________________________
Kaizen - Japanese, Lit: Never ending improvement
________________________________________________________________
- Raw text -