On Oct 8, 2008, at 8:49 AM, Lee, Frederick wrote:
I've seen examples of using [myVar release]. But doesn't setting myVar= nil does the same thing? Which is the preferred way?
This is a point of more contention than you may realize. The former is, of course, equivalent to
[self setMyVar:nil];which, as it calls a method on self during [self dealloc], is something frowned upon by many. It also triggers the KVO process, though if you're in dealloc, any KVO concerns should have finished long ago. On the other hand, it's a "purer" OO call style and allows you to stick with the property syntax as much as possible and lets you worry a bit less about memory management, which is nice.
YMMV, but you're probably safer doing [myVar release];. If you ever end up implementing your own -setMyVar: and it has side effects, there be demons ahead.
-> jp
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]