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:
http://msdn2.microsoft.com/en-us/library/2e70t5y1.aspx
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.
Daniel
_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel