From owner-cvs-src@FreeBSD.ORG Mon Nov 13 09:43:16 2006 Return-Path: X-Original-To: cvs-src@FreeBSD.org Delivered-To: cvs-src@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 801B816A494; Mon, 13 Nov 2006 09:43:16 +0000 (UTC) (envelope-from stefan@fafoe.narf.at) Received: from viefep14-int.chello.at (viefep15-int.chello.at [213.46.255.20]) by mx1.FreeBSD.org (Postfix) with ESMTP id BA19C43D45; Mon, 13 Nov 2006 09:43:14 +0000 (GMT) (envelope-from stefan@fafoe.narf.at) Received: from wombat.fafoe.narf.at ([213.47.85.26]) by viefep14-int.chello.at (InterMail vM.6.01.05.04 201-2131-123-105-20051025) with ESMTP id <20061113094312.FSDQ7416.viefep14-int.chello.at@wombat.fafoe.narf.at>; Mon, 13 Nov 2006 10:43:12 +0100 Received: by wombat.fafoe.narf.at (Postfix, from userid 1001) id B0E97BC87; Mon, 13 Nov 2006 10:43:11 +0100 (CET) Date: Mon, 13 Nov 2006 10:43:11 +0100 From: Stefan Farfeleder To: Bruce Evans Message-ID: <20061113094311.GC97460@wombat.fafoe.narf.at> References: <200611130428.kAD4ST0U093715@repoman.freebsd.org> <20061113173927.Q75708@delplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20061113173927.Q75708@delplex.bde.org> User-Agent: Mutt/1.5.13 (2006-08-11) Cc: Joseph Koshy , src-committers@FreeBSD.org, cvs-all@FreeBSD.org, cvs-src@FreeBSD.org Subject: Re: cvs commit: src/include ar.h X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Nov 2006 09:43:16 -0000 On Mon, Nov 13, 2006 at 07:30:11PM +1100, Bruce Evans wrote: > On Mon, 13 Nov 2006, Joseph Koshy wrote: > > >jkoshy 2006-11-13 04:28:29 UTC > > > > FreeBSD src repository > > > > Modified files: > > include ar.h > > Log: > > Attempt to improve application portability by marking `struct ar_hdr' > > as `packed'. > > > > The C standard leaves the alignment of individual members of a C > > struct upto the implementation, so pedantically speaking portable > > code cannot assume that the layout of a `struct ar_hdr' in memory > > will match its layout in a file. Using a __packed attribute > > declaration forces file and memory layouts for this structure to > > match. > > > > Submitted by: ru > > I don't see how this can be more portable. It uses an unportable > extension, but packing is automatic on all compilers that are known > to support this extension. On compilers that are not known to support > this extension (all except gcc >= 2.7 and icc), using __packed gives > a syntax error and thus changes code that is portable in practice into > code that doesn't compile. On lints that known not to support this > extension (FreeBSD lint), linting for portability is broken by not > giving the syntax error. > > In , all struct members are char arrays so there will be no > padding in practice. You seem to have missed the discussion on -current. GCC pads "struct foo { char c; };" to 4 bytes on ARM. I agree on __packed not being portable. Stefan