• 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: Newbie OOP style question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie OOP style question


  • Subject: Re: Newbie OOP style question
  • From: "Pierce T. Wetter III" <email@hidden>
  • Date: Fri, 12 May 2006 12:38:51 -0700


  But really, its just a matter of practice with the idiom:

   1. Did you call init? Better call release/autorelease somewhere.
   2. Did you get the object from someone else and you need to keep
it around? better call [retain].
   3. call [instanceObj release] on every instance variable in your
dealloc method.

This is incomplete.

Per the list guidelines, please don't reformulate the memory management rules in mail messages. The canonical rules are given in the documentation:

<http://developer.apple.com/documentation/Cocoa/Conceptual/ MemoryMgmt/Tasks/MemoryManagementRules.html#//apple_ref/doc/uid/ 20000994>

There are list guidelines about reformulating the rules? That's pretty wack.


 You're so cute when you're pedantic Mmalcom.

Though in this internet age, you have to watch out because things you say may come back to bite you. Here's Mmalcom's version of the rules:

http://www.stepwise.com/Articles/Technical/2001-03-11.01.html

 :-)

Personally, I vote for my version of the rules, as I think the official formulation could be clearer. It's the number one complaint the newbies have. Also, technically the rules are wrong, its not just instance variables where you need to retain objects, its any time you need to keep an object around. Also I notice that both you and I mention "dealloc", which the official rules don't, but that's where a big chunk of "release" calls have to live.

 Pierce
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Newbie OOP style question
      • From: mmalcolm crawford <email@hidden>
References: 
 >Re: Newbie OOP style question (From: Tim Gray <email@hidden>)
 >Re: Newbie OOP style question (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: Implementing Quit
  • Next by Date: Drawing icons for an on-screen display (OSD) like QuickTime
  • Previous by thread: Re: Newbie OOP style question
  • Next by thread: Re: Newbie OOP style question
  • Index(es):
    • Date
    • Thread