• 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: Simple dealloc question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Simple dealloc question


  • Subject: Re: Simple dealloc question
  • From: Bob Ueland <email@hidden>
  • Date: Mon, 15 Oct 2007 02:34:47 -0700 (PDT)

Thank you Robert and Amritendu, now I understand.

I have one more question. In the same code there is

// Standard accessors
- (Track *)track
{
    return [[track retain] autorelease];
}


Why not just
// Standard accessors
- (Track *)track
{
    return track;
}


Bob

----- Original Message ----
From: Robert Cerny <email@hidden>
To: Bob Ueland <email@hidden>
Cc: email@hidden
Sent: Monday, October 15, 2007 10:27:39 AM
Subject: Re: Simple dealloc question


Hi Bob,
you're right, it's completely sufficient to release track object.
However, setting it to nil helps tracking possible bugs in your code,
because you will immediately see in the debugger that you are sending
messages to nil object.

HTH
Robert

On 15.10.2007, at 9:58, Bob Ueland wrote:

> Found the following code in an example (track is a pointer to a
> Track object)
>
> - (void)dealloc
> {
>     [track release], track = nil;
>     [super dealloc];
> }
>
>
> What is the point of having track = nil? Wouldn't the following
> code be enough?
>
> - (void)dealloc
>
> {
>
>     [track release];
>
>     [super dealloc];
>
> }
>
>
> Bob
>
>
>
>
>
>
>
>
 ______________________________________________________________________
> ______________
> Shape Yahoo! in your own image.  Join our Network Research Panel
> today!   http://surveylink.yahoo.com/gmrs/yahoo_panel_invite.asp?a=7
>
>
> _______________________________________________
>
> 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







      ____________________________________________________________________________________
Don't let your dream ride pass you by. Make it a reality with Yahoo! Autos.
http://autos.yahoo.com/index.html



_______________________________________________

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

  • Follow-Ups:
    • Re: Simple dealloc question
      • From: Scott Anguish <email@hidden>
    • Re: Simple dealloc question
      • From: Robert Cerny <email@hidden>
    • Re: Simple dealloc question
      • From: Jonathan del Strother <email@hidden>
  • Prev by Date: Re: Simple dealloc question
  • Next by Date: Re: Simple dealloc question
  • Previous by thread: Re:Simple dealloc question
  • Next by thread: Re: Simple dealloc question
  • Index(es):
    • Date
    • Thread