Subject: Re: mklocale, take 2
To: Jason R Thorpe <thorpej@wasabisystems.com>
From: Todd Vierling <tv@wasabisystems.com>
List: tech-toolchain
Date: 10/18/2001 19:31:42
On Thu, 18 Oct 2001, Jason R Thorpe wrote:

:  > Yes, and that's the point.  If the compiler doesn't support packed structs,
:  > the code should be uncompilable on that compiler.  (Otherwise you'll end up
:  > with nondescript errors and crashes thanks to the improper alignment of
:  > data in the struct.)

: #pragma packed
: /* a structure you want packed */

: ...now, what pragma do I use for:
: /* another strucutre, that I don't want packed */

You wrap the structure on both sides, as in:

#pragma pack(1)
struct packedstruct {
};
#pragma pack

The second, without argument, resets packing to the compiler's ABI default.

-- 
-- Todd Vierling <tv@wasabisystems.com>  *  Wasabi NetBSD:  Run with it.
-- CDs, Integration, Embedding, Support -- http://www.wasabisystems.com/