If you use ARC, your pointers will be automatically set to zero. However, I do not believe that you are using ARC, in which case the pointer will matter to the garbage. This is dangerous because the one who called the function could get the result and thought that the pointer points to something real, since it is not equal to zero.
... , .
1:: , :
UIViewController *myVC = [[[UIViewController] alloc] init] autorelease];
2:: , :
UIViewController *myVC = nil;
myVC = [[[UIViewController] alloc] init] autorelease];
3:: nil,
UIViewController *myVC = nil;
if (someCondition)
{
myVC = [[[UIViewController] alloc] init] autorelease];
}
...