Re: dealloc and instance variables
Re: dealloc and instance variables
- Subject: Re: dealloc and instance variables
- From: Graeme Mathieson <email@hidden>
- Date: Sun, 23 Nov 2003 09:49:32 +0000
On 23 Nov 2003, at 08:44, Chris Hanson wrote:
Of course you mean
[ snip ]
right? Objective-C isn't C++; there's no automatic calling of any
superclass initializer.
Yeah, sorry, I was being too brief...
This says it deallocates the *space occupied* by the instance
variables in the class. Not that it releases the objects the instance
variables point to.
Ah, right. So what it's actually saying is that NSObject's dealloc
method effectively reverses the class alloc method?
While I'm here, another quick question: Is it valid to send a
message to a nil object?
Yes. Doing so just returns nil/NULL. Note that this may not do the
right thing if you're expecting a return value that isn't a
pointer-sized value.
Yeah. Most places, it's currently NSString I'm using in one form or
another and the common check is (aString && [aString length] > 0) and,
since the return value of sending a message to a nil object which
returns something other than an object is undefined, that check needs
to stay as-is.
--
Mail, MSN Messenger & Jabber: mathie [at] endless [dot] org [dot] uk
AIM: MathieEndless, Blog:
http://www.endless.org.uk/blog/
OpenPGP Fingerprint: 0F38 5000 999F 0644 76D6 968D A945 916E AD30 4A1A
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.