Yes, I saw this:
If the method returns a struct, as defined by the Mac OS X ABI Function Call Guide to be returned in registers, then a message sent to nil returns 0.0 for every field in the struct. Other struct data types will not be filled with zeros.
I just don't get it.
If you're using recent versions of the LLVM Compiler (Xcode 4.2 or later), then yes, messaging nil
with a struct-returning method will produce a zero-filled struct. In the case of CGRect
, that means a rect equal to CGRectZero
.
Source: Greg Parker, who works at Apple on the ObjC runtime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With