On 02/05/04 Uri Guttman wrote:
> with this struct (from leo with some minor changes):
> 
> struct xt {
>       char x;
>       struct yt {
>               char i,k;
>               int  j;
>       } Y;
>       char z;
> } X;
> 
> and this trivial script (i pass the filename on the command line):
[...]
> i get this lovely output:
> 
> struct yt
>         char i : offset 0
>         char k : offset 1
>         int j : offset 2
> struct xt
>         char x : offset 0
>         struct yt Y : offset 1
>         char z : offset 7
[...]
> BTW, this was on a sparc/solaris box.

The offsets look incorrect. On basically every modern 32 or 64 bit
OS (with sizeof(int) == 4) it should look like:

struct yt (size=8, alignment=4)
        char i : offset 0
        char k : offset 1
        int j : offset 4

struct xt (size=16, alignment=4)
        char x : offset 0
        struct yt Y : offset 4
        char z : offset 12

lupus

-- 
-----------------------------------------------------------------
[EMAIL PROTECTED]                                     debian/rules
[EMAIL PROTECTED]                             Monkeys do it better

Reply via email to