Subject: Re: mklocale, take 2
To: Todd Vierling <tv@wasabisystems.com>
From: James Chacon <jchacon@genuity.net>
List: tech-toolchain
Date: 10/18/2001 22:57:16
How again you're relying on a specific compilers implementation to potentially
guide you for all implementations.

I'd say leave it as an __attribute__ and wrap the compat version of sys/cdef.h
with some checks for GCC and other compilers. If it falls all the way through
just #error out and make the person trying a non-native build either use gcc
or add the definition for their hosts compiler.

James


>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/
>
>
>
>
>