Re: struct return of nil


Quincey Morris
 

On Apr 26, 2018, at 21:57 , Gerriet M. Denkmann <g@...> wrote:

Is this guaranteed to work in the future?

Yes:


“Working with nil

"Note: If you expect a return value from a message sent to nil, the return value will be nil for object return types, 0 for numeric types, and NO for BOOL types. Returned structures have all members initialized to zero."

This wasn’t true in the past, but at some point the clang compiler was changed to ensure a predictable result with a struct return type. (It isn’t true of the GCC compiler, AFAIK.)


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