From owner-freebsd-standards@FreeBSD.ORG Fri Apr 1 15:04:41 2005 Return-Path: Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CD9B016A4CE for ; Fri, 1 Apr 2005 15:04:41 +0000 (GMT) Received: from bgo1smout1.broadpark.no (bgo1smout1.broadpark.no [217.13.4.94]) by mx1.FreeBSD.org (Postfix) with ESMTP id 436E843D6B for ; Fri, 1 Apr 2005 15:04:41 +0000 (GMT) (envelope-from des@des.no) Received: from bgo1sminn1.broadpark.no ([217.13.4.93]) by bgo1smout1.broadpark.no (Sun Java System Messaging Server 6.1 HotFix 0.05 (built Oct 21 2004)) with ESMTP id <0IE900A5XWAHAB00@bgo1smout1.broadpark.no> for standards@freebsd.org; Fri, 01 Apr 2005 16:59:05 +0200 (CEST) Received: from dsa.des.no ([80.203.228.37]) by bgo1sminn1.broadpark.no (Sun Java System Messaging Server 6.1 HotFix 0.05 (built Oct 21 2004)) with ESMTP id <0IE9000HXWM8KU70@bgo1sminn1.broadpark.no> for standards@freebsd.org; Fri, 01 Apr 2005 17:06:08 +0200 (CEST) Received: by dsa.des.no (Pony Express, from userid 666) id 8C121BF790; Fri, 01 Apr 2005 17:04:38 +0200 (CEST) Received: from xps.des.no (xps.des.no [10.0.0.12]) by dsa.des.no (Pony Express) with ESMTP id 182289C5BA for ; Fri, 01 Apr 2005 17:04:36 +0200 (CEST) Received: by xps.des.no (Postfix, from userid 1001) id 0B05033C3E; Fri, 01 Apr 2005 17:04:36 +0200 (CEST) Date: Fri, 01 Apr 2005 17:04:35 +0200 From: des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=) To: standards@freebsd.org Message-id: <86br8yr118.fsf@xps.des.no> MIME-version: 1.0 Content-type: text/plain; charset=iso-8859-1 Content-transfer-encoding: quoted-printable X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on dsa.des.no User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3 (berkeley-unix) X-Spam-Status: No, score=-2.8 required=5.0 tests=ALL_TRUSTED,AWL autolearn=disabled version=3.0.2 X-Spam-Level: Subject: offsetof X-BeenThere: freebsd-standards@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Standards compliance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Apr 2005 15:04:41 -0000 I noticed that our definition of offsetof (in ) is as follows: #define __offsetof(type, field) ((size_t)(&((type *)0)->field)) This definition is gratuitously unportable (it assumes that a null pointer is all-bits-zero). A better definition would be the following: #define __offsetof(type, field) \ ((size_t)((char *)&((type *)0)->field - (char *)(type *)0)) DES --=20 Dag-Erling Sm=F8rgrav - des@des.no