objective c - difference between nil and released object -
i'm new objective-c , and can't understand this. know can send message nil (it's hyped feature of objective-c), can't send message released object, getting exception in case, difference between them?
nil
memory address 0. runtime knows not when address messaged, because the predefined nonexistant object address.
however, deallocated object random memory address, because pointer isn't cleaned when formerly valid object destroyed. since not prescribed nonexistant object address, runtime doesn't know it's invalid, , try send message. crash program right away.
you can avoid setting variables nil
once you've released them.
Comments
Post a Comment