From owner-freebsd-current Mon Jul 15 14: 8:49 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 7266537B401; Mon, 15 Jul 2002 14:08:45 -0700 (PDT) Received: from harrier.mail.pas.earthlink.net (harrier.mail.pas.earthlink.net [207.217.120.12]) by mx1.FreeBSD.org (Postfix) with ESMTP id EFEA143E4A; Mon, 15 Jul 2002 14:08:44 -0700 (PDT) (envelope-from tlambert2@mindspring.com) Received: from pool0196.cvx21-bradley.dialup.earthlink.net ([209.179.192.196] helo=mindspring.com) by harrier.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 17UD5E-00048g-00; Mon, 15 Jul 2002 14:08:40 -0700 Message-ID: <3D3339AA.CE251C69@mindspring.com> Date: Mon, 15 Jul 2002 14:07:54 -0700 From: Terry Lambert X-Mailer: Mozilla 4.79 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: Thomas Moestl Cc: Luigi Rizzo , Mike Barcroft , current@FreeBSD.org Subject: Re: different packing of structs in kernel vs. userland ? 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> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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 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, since it is legal to compute the size of > storage needed for an n-element array of struct foo by using > (sizeof(struct foo) * n). > > My point was that, because of the above, any padding that might be > required between the first and last member of two struct foo's > immediately following each other must be _included_ in struct foo, > after the last element. Reread my second to last paragraph. I'm saying the same thing that you are. In my third to last paragrap, I pointed to an example for directory entries that ensures end-pad independence (I wrote that code). -- Terry To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message