On Nov 18, 2008, at 8:24 PM, Peter N Lewis wrote:
I would actually write:

self.viewController = [[[UIViewController alloc]
initWithNibName:@"MoveMeView" bundle:[NSBundle mainBundle]] autorelease];

I like this best too. I like combining the autorelease with the alloc/ init because you don't have to worry about forgetting to do the release later. And this addresses the brevity issue that Marc asked about.

The ivar setting method is much more risky - changes far away from this code could introduce bugs.

Exactly. Although conceptually we are initializing the ivar, this is not happening in an init method and it's better not to assume the ivar is null.

--Andy

_______________________________________________

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]

Reply via email to