• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Warning with offsetof macro?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Warning with offsetof macro? (From: "Mark Wagner" <email@hidden>)

  • Prev by Date: Re: Xcode's 'Find in Files' UI problems/questions
  • Next by Date: GCC's -mstackrealign option
  • Previous by thread: Warning with offsetof macro?
  • Next by thread: Re: Warning with offsetof macro?
  • Index(es):
    • Date
    • Thread