Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 29 May 2002 10:42:25 -0700
From:      Peter Wemm <peter@wemm.org>
To:        Tony Finch <dot@dotat.at>
Cc:        Marcel Moolenaar <marcel@xcllnt.net>, Poul-Henning Kamp <phk@critter.freebsd.dk>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/sys gpt.h 
Message-ID:  <20020529174225.7DD3B3810@overcee.wemm.org>
In-Reply-To: <20020529173621.B11817@chiark.greenend.org.uk> 

next in thread | previous in thread | raw e-mail | index | archive | help
Tony Finch wrote:
> On Tue, May 28, 2002 at 10:36:53PM -0700, Marcel Moolenaar wrote:
> > 
> > I see what you mean, but packing and unpacking is not the problem. It's
> > sizeof() that's got it wrong. I don't quite understand why sizeof()
> > would yield a size that's 4 bytes longer than the structure actually
> > is. It smells like a gcc bug, but I assume for now I'm just missing
> > something.
> 
> It's required for correct alignment of the uint64_t members when you
> create an array of the struct.

ie:

struct foo {
	u_int64_t foo;
	u_int32_t bar;
}

sizeof(struct foo) = 16, not 12 like one might expect on i386.

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?20020529174225.7DD3B3810>