• 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
where does one do the autorelease?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

where does one do the autorelease?


  • Subject: where does one do the autorelease?
  • From: John Spicer <email@hidden>
  • Date: Thu, 22 Jul 2004 13:30:01 -0500

Here's some code, it's to take care of the instance if the passed in
string is actually a null class (from a database, for example).

Where does one put the autorelease in the else clause, before or after
the init? I think after but before I change lots of code I'd like to be
right ;)

- (void) setCOMMENT : (NSString *) str
{
if ([str isKindOfClass:[NSString class]])
{
[COMMENT autorelease];
COMMENT = [str copy];
}
else
{
COMMENT = [[NSString alloc] initWithString:@""];
[COMMENT autorelease];
}
}
_______________________________________________
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.


  • Follow-Ups:
    • Re: where does one do the autorelease?
      • From: James DiPalma <email@hidden>
    • Re: where does one do the autorelease?
      • From: mmalcolm crawford <email@hidden>
  • Prev by Date: Re: NSData being retained?
  • Next by Date: Re: NSData being retained?
  • Previous by thread: Re: NSData being retained?
  • Next by thread: Re: where does one do the autorelease?
  • Index(es):
    • Date
    • Thread