Re: FW: [iPAQ] skiff tools question

From: Gordon McNutt <gmcnutt.a.t.ridgerun.com>
Date: Thu Sep 14 2000 - 18:57:44 EDT

George France wrote:

> Correction:
>
> struct foo_t { u16 x; } __attribute__ ((packed));
>
> Best Regards,
>
> --George

I hope it's something that simple. But the following example makes me
worry that it is not, as this example does not use structs:

  u8 buf[4];
  u16 *a;
  a = &buf[1];
  *a = 4;

Printing the contents of buf shows one thing on the ARM:

0xbffffc40 = 0x4
0xbffffc41 = 0x0
0xbffffc42 = 0x0
0xbffffc43 = 0x0

and another on the i386:
0xbffff914 = 0x0
0xbffff915 = 0x4
0xbffff916 = 0x0
0xbffff917 = 0x0

It appears that on the ARM, the address of a variable is the last byte
of the variable, but on the i386 it is the first. It seems that this
makes overlaying structs non-portable.

Thanks,
--Gordon
Received on Thu Sep 14 15:57:44 2000

This archive was generated by hypermail 2.1.8 : Tue May 04 2004 - 09:43:42 EDT