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

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -