Re: Warning with offsetof macro?
Re: Warning with offsetof macro?
- Subject: Re: Warning with offsetof macro?
- From: Steve Sisak <email@hidden>
- Date: Wed, 14 Jun 2006 16:05:39 -0400
At 12:47 PM -0700 6/14/06, Eric Albert wrote:
On Jun 14, 2006, at 12:19 PM, 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)
Turn off "Warn About Undefined Use of offsetof Macro" in your
project or target settings.
Is there a way to turn off this warning on a case by case basis?
The common idiom is typically using OS-level linked-list management
routines where it's necessary to recover an object pointer from the
address of an instance variable (link).
(Of course it would be more useful if offsetof() was a built-in
rather than a macro or C++ provided an explicit means of recovering
an object from the address on an instance variable)
----------------------
On a related note, turning on "effective C++" warnings complains
about non-virtual destructors in stack-based objects when have no
virtual methods.
This is not helpful -- a more reasonable test would be the first time
a class with a virtual method inherits from a class with a
non-virtual destructor or, even better the first time one is
instantiated with operator new rather than on the stack as this is
the real problem with non-virtual destructors.
Is it worth filing a bug on this or is it too religious? I'd like to
turn these warnings on if I could get rid of the false positives and
in some cases, I don't want to create a vtable.
Cheers,
-Steve
_______________________________________________
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