From owner-freebsd-current Mon Jul 15 18: 1:18 2002 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6307337B400 for ; Mon, 15 Jul 2002 18:01:15 -0700 (PDT) Received: from mail.yadt.co.uk (yadt.demon.co.uk [158.152.4.134]) by mx1.FreeBSD.org (Postfix) with SMTP id 233A243E31 for ; Mon, 15 Jul 2002 18:01:07 -0700 (PDT) (envelope-from davidt@yadt.co.uk) Received: (qmail 62374 invoked from network); 16 Jul 2002 01:01:04 -0000 Received: from unknown (HELO mail.gattaca.yadt.co.uk) (10.0.0.2) by yadt.demon.co.uk with SMTP; 16 Jul 2002 01:01:04 -0000 Received: (qmail 56172 invoked by uid 1000); 16 Jul 2002 01:01:00 -0000 Date: Tue, 16 Jul 2002 02:01:00 +0100 From: David Taylor To: current@FreeBSD.org Subject: Re: different packing of structs in kernel vs. userland ? Message-ID: <20020716010100.GA55990@gattaca.yadt.co.uk> Mail-Followup-To: current@FreeBSD.org References: <20020714011810.A72236@iguana.icir.org> <20020714203642.GD314@crow.dom2ip.de> <20020714230821.C64412@espresso.q9media.com> <20020715105158.GA314@crow.dom2ip.de> <20020715040008.A85276@iguana.icir.org> <3D32B0F1.27EA45EE@mindspring.com> <20020715125735.GC314@crow.dom2ip.de> <3D3339AA.CE251C69@mindspring.com> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <3D3339AA.CE251C69@mindspring.com> User-Agent: Mutt/1.3.99i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, 15 Jul 2002, Terry Lambert wrote: > Thomas Moestl wrote: > > > He's making the valid point that for: > > > > > > struct foo *fee; > > > > > > It's possible that: > > > > > > sizeof(struct foo) != (((char *)&fee[1]) - ((char *)&fee[0])) > > > > No, I do not. In fact, the opposite: > > > > sizeof(struct foo) = (((char *)&fee[1]) - ((char *)&fee[0])) > > > > _must_ always be true > Reread my second to last paragraph. I'm saying the same thing > that you are. How can you possibly be saying the same thing, when you are saying the exact opposite (You: A != B may be true, Thomas: A == B must be true)? You're saying: sizeof(struct foo) != (((char *)&fee[1]) - ((char *)&fee[0])) which would imply that end-padding is not included in sizeof(struct foo), when it must be, otherwise malloc(n * sizeof(struct foo)) would not allocate enough memory for an array of n elements of struct foo. -- David Taylor davidt@yadt.co.uk "The future just ain't what it used to be" To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message