Date: Mon, 03 Nov 1997 11:21:15 +1030 From: Mike Smith <mike@smith.net.au> To: Christoph Kukulies <kuku@gilberto.physik.RWTH-Aachen.DE> Cc: freebsd-hackers@freefall.FreeBSD.org Subject: Re: gcc and bitfields Message-ID: <199711030051.LAA00604@word.smith.net.au> In-Reply-To: Your message of "Sun, 02 Nov 1997 16:31:07 BST." <199711021531.QAA04864@gil.physik.rwth-aachen.de>
next in thread | previous in thread | raw e-mail | index | archive | help
>
> During porting a piece of a DOS program to make a driver
> for FreeBSD of it for a certain device I'm stuck at the
> point where there is a structure:
>
> struct C_OPEN {
> int a;
> int b;
> unsigned xdt:1;
> unsigned reserved:15;
> }
>
> The sizeof this structure is 10 under DOS (borland C)
> and evaluates to 12 under cc (gcc) on FreeBSD.
>
> There are a lot of these definitions and it would be
> tedious to find a workaround.
>
> Does anyone know if I can pack the structure respectively
> enforce the bitfield to a short int?
__attribute__ ((packed))
(Read the info entry on gcc, under 'C extensions/Variable Attributes'.
mike
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199711030051.LAA00604>
