On Tue, Dec 17, 2002 at 10:06:21AM +0100, Henk Jonas wrote:
> Hm, I just had a look into the example source and found a strange 
> behaviour or maybe I'm just blind...
[...]
>       DmWrite(recordP, (Int32)&d->options, &s->options, sizeof(s->options));
>       offset = (Int32)&d->firstField;
> 
> d is a pointer to PrvAddrPackedDBRecord and is set to NULL. But as you 
> can see, some lines later the content of d is accessed. But d is NULL, 
> where shall d->firstField or d->options point to? Very interesting...

Only the address of the field is used; the contents are never accessed.
It's a revolting, confusing, and non-portable [1] way of writing
offsetof [2].

    John

[1] Of course using DmWrite means you're only interested in Palm OS, and
    this works everywhere on m68k Palm OS, so the non-portability is not
    particularly an issue here.

[2] If you think I mean OffsetOf, see
    http://groups.google.com/groups?selm=qkdeKqSlAHA.221%40www.massena.com

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to