Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 4 Jun 2003 12:09:34 +0200
From:      Stefan Farfeleder <stefan@fafoe.dyndns.org>
To:        Tony Finch <dot@dotat.at>
Cc:        Mike Barcroft <mike@FreeBSD.org>
Subject:   Re: GNU extensions on FreeBSD 5.x headers
Message-ID:  <20030604100934.GC584@wombat.fafoe>
In-Reply-To: <20030604083821.GM18938@chiark.greenend.org.uk>
References:  <20030603215322.31853.qmail@web13403.mail.yahoo.com> <20030603210338.A70533@espresso.bsdmike.org> <20030604083821.GM18938@chiark.greenend.org.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Jun 04, 2003 at 09:38:21AM +0100, Tony Finch wrote:
> On Tue, Jun 03, 2003 at 09:03:38PM -0400, Mike Barcroft wrote:
> > 
> > I think those of us who've played with alternative compilers are aware
> > of this requirement.  I'm not sure there's anything we can do about
> > it.  If anyone has any tricks to force 128-bit alignment without a
> > 128-bit type in standard C, I'd love to hear it.
> 
> Not in standard C (since it doesn't allow you to express alignment and
> padding requirements), but in C-as-she-is-spoke why not insert the
> necessary padding explicitly?

By adding padding to a struct you can only align the offset of a struct
member:

struct foo {
	...
	char	padding[N];
	bar	aligned;
	...
};

What you cannot do with padding is to align a non-dynamically allocated
object of type struct foo as in:

	struct foo	f;

There's no way I can see to guarantee that f.aligned is 128-bit aligned.

Regards,
Stefan



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