[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] i386 Double alignment- bug?

From: Daniel Glöckner
Subject: Re: [Tinycc-devel] i386 Double alignment- bug?
Date: Tue, 19 Sep 2006 19:55:02 +0200
User-agent: Mutt/

On Tue, Sep 19, 2006 at 09:56:17AM -0700, Mike Henning wrote:
> I noticed that the sizeof a double is returned as 8,
> which should be correct, but 4 is returned in align.

This is correct behaviour on x86 Linux.
GCC has a command line switch to align doubles to 8 bytes.

> #pragma pack(8)
> typedef struct _foo
> {
> char    a;
> int     v1;
> int     v2;
> double  d1;
> }foo;
> sizeof(foo) = 20 regardless of the pack value set.
> Using the above example it should return 24.

No, it shouldn't.
Pragma pack sets the maximum alignment as is described here:

Anyway, pragma pack is non-standard and TinyCC is allowed to do whatever
it wants. It just so happens, that TinyCC behaves the same way MSVC does.

> So should align be returning 8 here?

Only if you are using TinyCC in Windows.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]