Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 May 2002 18:50:07 -0700
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        Peter Wemm <peter@wemm.org>
Cc:        Jens Schweikhardt <schweikh@schweikhardt.net>, Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/sys gpt.h
Message-ID:  <20020530015007.GA393@dhcp01.pn.xcllnt.net>
In-Reply-To: <20020529234420.3FE6B380A@overcee.wemm.org>
References:  <20020529230137.GA306@dhcp01.pn.xcllnt.net> <20020529234420.3FE6B380A@overcee.wemm.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, May 29, 2002 at 04:44:20PM -0700, Peter Wemm wrote:
> Marcel Moolenaar wrote:
> > On Wed, May 29, 2002 at 11:32:48PM +0200, Jens Schweikhardt wrote:
> > > 
> > > It is. The answer is sizeof (struct X). You are the one to make
> > > nonportable assumptions by thinking there must be no padding.
> > 
> > No, I assume that the compiler does do gratuitous padding, beyond
> > what is reasonable or expected. Especially not to extend the size
> > of the struct after the last field.
> 
> This has got me before.  The usual behavior is that the stuct is rounded up
> to be an even multiple of the most restrictive alignment requirement of
> members.  This is so that sizeof(struct foo[20]) == sizeof(struct foo) * 20.

Strangely enough, I find it more natural when the equality doesn't
hold in case the struct size if not a multiple of the alignment.

What really kicks me in the nuts is that I have never seen or experienced
this behaviour before. Sure, padding between fields, naturally, but
extending the size of a structure.. no. That's why I'm so totally amazed.
We're talking POLA violation here for me; with big V... :-(

As such, I'll be digesting this for the next couple of days. I have a
very strong tendency to reject this behaviour as the most stupid thing
since...  since... wow, I think it really stands alone in its infinite
stupidity :-) Clearly not the right mindset to be hacking...

-- 
 Marcel Moolenaar	  USPA: A-39004		 marcel@xcllnt.net

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020530015007.GA393>