[Top][All Lists]

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

Re: [Tinycc-devel] HELP: __attribute__ ((packed)) confusion

From: Christopher Dobbs
Subject: Re: [Tinycc-devel] HELP: __attribute__ ((packed)) confusion
Date: Sun, 13 Feb 2005 19:47:43 -0800
User-agent: Mozilla Thunderbird 0.5 (X11/20040208)

I am doing that, will re-post when I have a better idea of where the problem is.

BTW: thankyou to all the good responses.  I really like tcc and all that it can do.
one of the projects I want to use tcc in is a distributed OS.
I think that tcc can (and will, when a few minor features that are in gcc also exist in tcc) over come gcc in usage.

Christopher Dobbs

Dave Dodge wrote:
On Thu, Feb 10, 2005 at 03:21:11PM -0800, Christopher Dobbs wrote:
#define PACKED __attribute__ ((__packed__))

typedef struct {                        // 512 byte header
unsigned char bc[3];                  // Boot Code Signature
unsigned char signature[8];           // signature string "LIBV10"
PACKED unsigned long dir;                    // offset of first dir block
PACKED unsigned long freechain;              // offset of first block
PACKED unsigned long eof;                    // offset of end of 
unsigned char label[41];              // Volume Label
unsigned long attr;                   // Volume Attributes
char          passcode[16];           // Volume Password
unsigned char fill[428];              // Filler
} header;
This compiled to 512 for me, but when I put it in my header, it came out 

If you mean that this exact same structure (word for word) with the
same attribute settings produces different field offsets when you put
it in your header file instead of compiling it by itself, then that
suggests either:

  - there's something else in your header interfering with this, such
    as a #define or typedef; or

  - there's a bug in tcc.

It would be useful if you can at least figure out which of these is
the case.  For example you could try inserting the structure at
different positions in your header file, or you could start with just
the structure by itself and progressively add pieces of your header
file, until the size change is observed.

                                                  -Dave Dodge

Tinycc-devel mailing list

reply via email to

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