• 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
on NSString usage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

on NSString usage


  • Subject: on NSString usage
  • From: "Chong Hiu Pun" <email@hidden>
  • Date: Thu, 1 Aug 2002 15:41:19 +0800

I have a class variable:
NSString *strResult;

which will be modified inside a few different function.

-(void) functionA
{
....
strResult=@"aaa";
}

-(void) functionB
{
....
strResult=@"bbb";
}

-(void) functionC
{
....
strResult=@"ccc";
}

-(NSString*) GetIt
{
....
return strResult;
}

I will execute functionA , functionB and then functionC and get the strResult.
My question is:

1.) In this case, how the memory managed. Do I need to call [alloc] and [init]
on strResult before enter into functionA
2.) After running out of the scope of functionC, will strResult became
autorelease, and I lost the content of strResult inside funtion GetIt?

Thank you very much!
_______________________________________________
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: on NSString usage
      • From: Chris Hanson <email@hidden>
  • Prev by Date: Window transformations in Cocoa
  • Next by Date: Re: on NSString usage
  • Previous by thread: Re: Window transformations in Cocoa
  • Next by thread: Re: on NSString usage
  • Index(es):
    • Date
    • Thread