struct return of nil


Gerriet M. Denkmann
 

macOS 13.4; Xcode Version 9.3 (9E145).

This is (I believe) documented to work:

NSString *answer = …
if ( answer.length == 0 )
{
// works for answer = nil or answer = “” (empty string)
answer = @“No answer given”;
};

But what about this:

NSImage *image = …
if ( NSEqualSizes( image.size, NSZeroSize ) )
{
// works for image = nil or non-nil image with zero size
image = … some default image instead …
};

Is this guaranteed to work in the future?

Gerriet.

Join {cocoa@apple-dev.groups.io to automatically receive all group messages.