Re: Warning with offsetof macro?
Re: Warning with offsetof macro?
- Subject: Re: Warning with offsetof macro?
- From: David Dunham <email@hidden>
- Date: Wed, 14 Jun 2006 12:34:17 -0700
On 14 Jun 2006, at 12:19, Mark Wagner wrote:
How do I get rid of this warning?
../NEO/NeoIncludes/CNeoIOBlock.h:85: warning: invalid access to
non-static data member `CNeoIOBlock::fPB' of NULL object
../NEO/NeoIncludes/CNeoIOBlock.h:85: warning: (perhaps the `offsetof'
macro was used incorrectly)
The line of code in question is
static CNeoIOBlock *GetIOBlock(NeoIOParams *aIOParams) {return
(CNeoIOBlock *)((char *)aIOParams - offsetof(CNeoIOBlock, fPB));}
which appears to be a function that takes a pointer to an object
member, and returns a pointer to the object.
Looks like a class with instance data fPB, and a class function that
tries to access instance data without an object around. Perhaps you
can make it a method instead of a function.
------------
David Dunham email@hidden http://www.pensee.com/dunham/
"No matter how far you have gone on a wrong road, turn back." -
Turkish proverb
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden