Re: New C++ warning about comparing this==NULL
Re: New C++ warning about comparing this==NULL
- Subject: Re: New C++ warning about comparing this==NULL
- From: Jeremy Hughes <email@hidden>
- Date: Thu, 03 Dec 2015 17:27:19 +0000
- Organization: Softpress
Jens Alfke (2/12/15, 19:22) said:
>In Xcode 7 some C++ code of mine has started being flagged with a new warning:
>
>Value.cc:45:13: error: 'this' pointer cannot be null in well-defined C++
>code; comparison may be assumed to always evaluate to false [-Werror,-
>Wtautological-undefined-compare]
> if (this == NULL) return kNull;
> ^~~~ ~~~~
If you want to remove the warning, you could assign 'this' to another pointer and test that:
void *p = this;
if (p == NULL)
return kNull;
Jeremy
_______________________________________________
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