Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 May 2002 16:44:20 -0700
From:      Peter Wemm <peter@wemm.org>
To:        Marcel Moolenaar <marcel@xcllnt.net>
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:  <20020529234420.3FE6B380A@overcee.wemm.org>
In-Reply-To: <20020529230137.GA306@dhcp01.pn.xcllnt.net> 

next in thread | previous in thread | raw e-mail | index | archive | help

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.

I have a vague recollection that I saw a compiler a long time ago (early
Lattice C on the Amiga possibly?) where this wasn't the case.

Cheers,
-Peter
--
Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com
"All of this is for nothing if we don't go to the stars" - JMS/B5


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?20020529234420.3FE6B380A>