From owner-freebsd-hackers Sun Nov 2 16:55:21 1997 Return-Path: Received: (from root@localhost) by hub.freebsd.org (8.8.7/8.8.7) id QAA22461 for hackers-outgoing; Sun, 2 Nov 1997 16:55:21 -0800 (PST) (envelope-from owner-freebsd-hackers) Received: from word.smith.net.au (vh1.gsoft.com.au [203.38.152.122]) by hub.freebsd.org (8.8.7/8.8.7) with ESMTP id QAA22433 for ; Sun, 2 Nov 1997 16:55:12 -0800 (PST) (envelope-from mike@word.smith.net.au) Received: from word.smith.net.au (localhost.gsoft.com.au [127.0.0.1]) by word.smith.net.au (8.8.7/8.8.5) with ESMTP id LAA00604; Mon, 3 Nov 1997 11:21:15 +1030 (CST) Message-Id: <199711030051.LAA00604@word.smith.net.au> X-Mailer: exmh version 2.0zeta 7/24/97 To: Christoph Kukulies cc: freebsd-hackers@freefall.FreeBSD.org Subject: Re: gcc and bitfields In-reply-to: Your message of "Sun, 02 Nov 1997 16:31:07 BST." <199711021531.QAA04864@gil.physik.rwth-aachen.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Mon, 03 Nov 1997 11:21:15 +1030 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk > > 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