From owner-cvs-all@FreeBSD.ORG Mon Nov 13 17:27:49 2006 Return-Path: X-Original-To: cvs-all@freebsd.org Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 5434516A47B; Mon, 13 Nov 2006 17:27:49 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from harmony.bsdimp.com (vc4-2-0-87.dsl.netrack.net [199.45.160.85]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7835843F3C; Mon, 13 Nov 2006 17:19:17 +0000 (GMT) (envelope-from imp@bsdimp.com) Received: from localhost (localhost [127.0.0.1]) by harmony.bsdimp.com (8.13.4/8.13.4) with ESMTP id kADHIB0k097607; Mon, 13 Nov 2006 10:18:12 -0700 (MST) (envelope-from imp@bsdimp.com) Date: Mon, 13 Nov 2006 10:18:48 -0700 (MST) Message-Id: <20061113.101848.-1558770561.imp@bsdimp.com> To: phk@phk.freebsd.dk From: "M. Warner Losh" In-Reply-To: <3801.1163410519@critter.freebsd.dk> References: <20061113173927.Q75708@delplex.bde.org> <3801.1163410519@critter.freebsd.dk> X-Mailer: Mew version 4.2 on Emacs 21.3 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-2.0 (harmony.bsdimp.com [127.0.0.1]); Mon, 13 Nov 2006 10:18:12 -0700 (MST) Cc: jkoshy@freebsd.org, src-committers@freebsd.org, cvs-all@freebsd.org, bde@zeta.org.au, cvs-src@freebsd.org Subject: Re: cvs commit: src/include ar.h X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 13 Nov 2006 17:27:49 -0000 In message: <3801.1163410519@critter.freebsd.dk> "Poul-Henning Kamp" writes: : In message <20061113173927.Q75708@delplex.bde.org>, Bruce Evans writes: : >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. : : I agree with bruce that __packed is not the way to go. : : For things that represent communication protocols, even if : they happen through files, I advocate using the functions : in sys/endian.h to explicitly decode and encode fields into : bytestrings. Until that happens, __packed is the only way to get correct code on the arm. Warner