• 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 question regarding Learning Cocoa
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Newbie question regarding Learning Cocoa


  • Subject: Re: Newbie question regarding Learning Cocoa
  • From: Peter Ammon <email@hidden>
  • Date: Tue, 05 Jun 2001 09:55:48 -0700

on 6/5/01 6:01 AM, Andreas Monitzer at email@hidden wrote:

> On Monday, June 4, 2001, at 07:52 , Finlay Dobbie wrote:
>
>> @"Hello world" is actually an NSString object, which I think might be
>> autoreleased, I'm not sure..
>
> It's not autoreleased, it's static. That means that it's part of the code,
> it exists in RAM as long as the class exists there. So don't call retain,
> release or autorelease on a static NSString.
>
> andy

A nitpick: retain, release, and autorelease don't do anything to a static
NSString, but that doesn't mean you should go out of your way to avoid
calling them. For example, you can write methods like this:

- (void)setString:(NSString*)newString {
[myString release];
myString=[newString retain];
}

without worrying about whether newString or myString is static or not.

-Peter


References: 
 >Re: Newbie question regarding Learning Cocoa (From: Andreas Monitzer <email@hidden>)

  • Prev by Date: Re: Not so basic after all (was: Very Basic)
  • Next by Date: Re: Connecting actions to menu
  • Previous by thread: Re: Newbie question regarding Learning Cocoa
  • Next by thread: Re: Newbie question regarding Learning Cocoa
  • Index(es):
    • Date
    • Thread