For anyone who's interested, heres the definition of the offsetof macro:
#define offsetof(type, field) ((DWord)(&((type*)0)->field))
And it works great!
(My last contribution to the list for the year!)
Happy New Year!

Robert Foster
Mountain Visions P/L
Australia.

-----Original Message-----
From: Bryan Nystrom [mailto:[EMAIL PROTECTED]]
Sent: Friday, 31 December 1999 18:17
To: [EMAIL PROTECTED]
Subject: RE: DmWrite behavior.


I'm here to put this horse (I mean thread) out to pasture. Thanks for all
the help folks. Chris actually followed up with me via personal email with
one final debugging suggestion identified the problem:

 if (sizeof(mItemA) != sizeof(src->mItemA)){
        ShootBryan(bigGun);     // I don't need any volunteers
}

Since mItemA was 2 bytes and src->mItemA was 1, only the first byte (00) of
mItemA was being written. My stupid oversight. Bit again by a Cut&Paste
frenzy.

SO, to sum it up: DmWrite works great. The CW R6 C++ compiler wasn't to
blame. The world will not end at midnight Friday.

Thanks again, everyone.

Bryan Nystrom


PS: I was not able to find the macro for offsetof(x,y) defined anywhere
under OS 3.1. Am I missing something? Was it only in 3.0 or with the earlier
R5 Codewarrior? Looked like a handy macro.


Reply via email to