Date: Mon, 15 Jul 2002 14:07:54 -0700 From: Terry Lambert <tlambert2@mindspring.com> To: Thomas Moestl <tmoestl@gmx.net> Cc: Luigi Rizzo <luigi@FreeBSD.org>, Mike Barcroft <mike@FreeBSD.org>, current@FreeBSD.org Subject: Re: different packing of structs in kernel vs. userland ? Message-ID: <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>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3D3339AA.CE251C69>