From: johne AT parallax DOT co DOT uk (John Eccleston) Newsgroups: comp.os.msdos.djgpp Subject: Re: Padding Question Date: Wed, 11 Dec 96 09:07:28 GMT Organization: Parallax Solutions Ltd Lines: 57 Message-ID: <58ltk9$i1n@red.parallax.co.uk> References: <32A810D9 DOT 366E9B4E AT m-net DOT arbornet DOT org> NNTP-Posting-Host: parsnip.parallax.co.uk To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp In article <32A810D9 DOT 366E9B4E AT m-net DOT arbornet DOT org>, Rohit Jalan wrote: >Hi !! > >Is it possible to stop gcc from padding structures ? > >Thnx. >Rohit > 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 ________________________________________________________________