Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 30 May 2002 09:12:17 +0100
From:      Tony Finch <dot@dotat.at>
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:  <20020530091217.A10098@chiark.greenend.org.uk>
In-Reply-To: <20020529230137.GA306@dhcp01.pn.xcllnt.net>; from marcel@xcllnt.net on Wed, May 29, 2002 at 04:01:37PM -0700
References:  <200205290258.g4T2wgF83137@freefall.freebsd.org> <9551.1022648961@critter.freebsd.dk> <20020529053653.GA306@dhcp01.pn.xcllnt.net> <20020529173621.B11817@chiark.greenend.org.uk> <20020529131927.C64995@kayak.xcllnt.net> <200205292027.g4TKRfnv031668@khavrinen.lcs.mit.edu> <20020529133846.E64995@kayak.xcllnt.net> <20020529233248.A24780@schweikhardt.net> <20020529230137.GA306@dhcp01.pn.xcllnt.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, May 29, 2002 at 04:01:37PM -0700, Marcel Moolenaar wrote:
> 
> 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.

C99 section 6.7.2.1 "Structure and union specifiers" paragraph 14:
"There may be unnamed padding at the end of a structure or union."

I wonder how you expect C to work without this permission, given
that pointer arithmetic is defined in terms of the size of the
object pointed to, and given hard alighment requirements on some
machines.

	(char *)(p + 1) == (char *)p + sizeof(*p)
	p + 1 == &p[1]

(Despite what phk says C must always have allowed padding at the
end of structs. Many implementations, especially on PCs which don't
have hard alignment requirements, won't have used the facility.)

Tony.
-- 
f.a.n.finch <dot@dotat.at> http://dotat.at/
SOUTHEAST ICELAND: CYCLONIC 4 OR 5, OCCASIONALLY 6 IN SOUTH LATER. RAIN AT
TIMES. MODERATE OR POOR.

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?20020530091217.A10098>