• 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: NSTableView and check boxes (for the hundredth time)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTableView and check boxes (for the hundredth time)


  • Subject: Re: NSTableView and check boxes (for the hundredth time)
  • From: Ondra Cada <email@hidden>
  • Date: Fri, 4 Oct 2002 00:50:26 +0200

On Thursday, October 3, 2002, at 11:29 , j o a r wrote:

I don't think you should always use autorelease instead of release, so I'
ll have to comment on that...
...
(protoCell = [[[NSButtonCell alloc] init] autorelease]; )

I'm kinda busy now, but in short: the most important reason why the line above is right is code robustness: it helps you debug your reatain bugs by the ideal way: you don't make them!

OTOH, the pattern of

foo=[[Bar alloc] init];
...
[foo release];

is the more fragile and prone to bugs the more lines there is in place of "...".

The fact that the former is *also* leakless whilst tle latter would leak as soon as an excpetion occurs is nice too, and it is definitely not true that if an expception might occur you should always catch it: quite contrariwise; the most important advantage of exceptions (when compared with traditional error code returning) is that they can be generated in the lowermost layer and catchet in the uppermost one, without all those betwixt even knowing of them.

And as for golden words, "Don't autorelease when you can release" does not qualify the slightest bit. *Don't optimize until needed* does, though ;)
---
Ondra Cada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc
_______________________________________________
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.
References: 
 >Re: NSTableView and check boxes (for the hundredth time) (From: j o a r <email@hidden>)

  • Prev by Date: Re: Carbon vs Cocoa
  • Next by Date: Re: NSNetService addresses returns empty array
  • Previous by thread: Re: NSTableView and check boxes (for the hundredth time)
  • Next by thread: Re: NSTableView and check boxes (for the hundredth time)
  • Index(es):
    • Date
    • Thread