• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: I want my app to crash!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: I want my app to crash!


  • Subject: Re: I want my app to crash!
  • From: M Pulis <email@hidden>
  • Date: Wed, 17 Jun 2009 05:23:39 -0700

Thanks, Andy. Excellent point.

Seems to me I remember reading that... now!

After always checking for nil allocation and error codes on various systems (my style since '78) and reinforced by MacOS toolbox procedural programming from '83, it is hard to write what looks like trusting code.

It is easier to write, however, so I'll get there!

Apologies for the noise.

MP
(learning to chill out)

On Jun 17, 2009, at 4:37 AM, Andy Lee wrote:

On Jun 17, 2009, at 6:29 AM, M Pulis wrote:
Most of us see the alloc init pattern when learning from example code for a quick feature demo. For purposes of brevity, example code is never meant to demonstrate error handling, much like I don't expect to see MyClass in shipping source.

The reason for the alloc/init idiom is to avoid this easy-to-make mistake:


    MyClass *myObject = [MyClass alloc];
    [myObject init];

I don't mean this as an answer to the larger question about nil- messaging, but to point out that this is an explicitly recommended idiom, not just a way for the authors of the examples to save a few keystrokes.

--Andy

_______________________________________________

Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


References: 
 >Re: I want my app to crash! (From: Andreas Grosam <email@hidden>)
 >Re: I want my app to crash! (From: M Pulis <email@hidden>)
 >Re: I want my app to crash! (From: Andy Lee <email@hidden>)

  • Prev by Date: Re: I want my app to crash!
  • Next by Date: Re: get ref to instance from IB
  • Previous by thread: Re: I want my app to crash!
  • Next by thread: NSImageView/NSImage question
  • Index(es):
    • Date
    • Thread