Date: Tue, 16 Jul 2002 02:01:00 +0100 From: David Taylor <davidt@yadt.co.uk> To: current@FreeBSD.org Subject: Re: different packing of structs in kernel vs. userland ? Message-ID: <20020716010100.GA55990@gattaca.yadt.co.uk> In-Reply-To: <3D3339AA.CE251C69@mindspring.com> 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>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020716010100.GA55990>