Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

XCode 6.3 Warning : Comparison of address of 'myObject' not equal to null pointer is always true

After updating to XCode 6.3, compiler started giving this warning.

Comparison of address of 'myObject' not equal to null pointer is always true.

Here is my piece of code,

enter image description here

Scratching my head with it, but didn't find any solution or workaround to get rid of this warning.

My question is linked with question over here. But, it can't be solved using answer discussed.

Any help will be welcomed :)

like image 365
itsji10dra Avatar asked Apr 10 '15 11:04

itsji10dra


1 Answers

Correct way of checking the pointer is

if (anotherInView != nil) {
}

You are comparing address of a variable with the NULL. Every variable has an address you can't have a variable whose address is NULL, you can have a variable whose value is NULL

Also anotherRect != NULL is again not valid. anotherRect will always have a value as it's a struct

like image 77
Inder Kumar Rathore Avatar answered Sep 21 '22 06:09

Inder Kumar Rathore