From: j DOT aldrich6 AT genie DOT com Message-Id: <199605122216.AA124429376@relay1.geis.com> Date: Sun, 12 May 96 22:13:00 UTC 0000 To: djgpp AT delorie DOT com Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Subject: Re: more sizeof questions Reply to message 2215819 from ELIZ AT IS DOT ELTA. on 05/12/96 4:32AM >> 2) Conditionally pack the structure only if you are using a GNU compiler, > >Most 32-bit compilers pad structs to avoid significant runtime penalty >for unaligned accesses. So, conditioning that code on GCC alone is not >exactly the correct procedure. You should use some symbol that implies a >32-bit compiler. Actually, I was wondering about that... is there a specific define I can check to find out if a given compiler pads structs, or would I have to test for each individual compiler? Also, according to the docs, __attribute__ only works with later versions of gcc; is there any way besides #pragma pack() to pack structs on other compilers? >There are many headers in any Unix program that cannot be found on any >other DOS compiler except DJGPP; unistd.h is only one of them. This is >one of the main problems that make porting a Unix programs to the other >compilers a programmer's nightmare. And one of the main reasons I like DJGPP so much. :) BTW, I noticed something slightly odd a while back about #defines. I ran gcc with options to output a list of all macro definitions (-dM, I think), and discovered that apparently, DJGPP defines by default both "MSDOS" and "unix". Isn't this a bit contradictory? John