• 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: Performance, Efficiency - Coding practice
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Performance, Efficiency - Coding practice


  • Subject: Re: Performance, Efficiency - Coding practice
  • From: Roland King <email@hidden>
  • Date: Fri, 29 May 2009 08:57:00 +0800


So if i have:

NSMutableString *title = [[NSString alloc] init];
[title setString: @"test"];

That would be correct and safe?

Thank!!
John



No. I hope it would emit warnings on compilation too. That would set title to an NSString instance, then you go calling setString: on it and that's an NSMutableString member function, so it would crash with an unimplemented selector.


If you want title to be an NSMutableString* then you need to alloc and init an NSMutableString for it.
_______________________________________________


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: Performance, Efficiency - Coding practice
      • From: Michael Ash <email@hidden>
References: 
 >Performance, Efficiency - Coding practice (From: John Ku <email@hidden>)
 >Re: Performance, Efficiency - Coding practice (From: Kyle Sluder <email@hidden>)
 >Re: Performance, Efficiency - Coding practice (From: John Ku <email@hidden>)

  • Prev by Date: Re: Performance, Efficiency - Coding practice
  • Next by Date: Re: Performance, Efficiency - Coding practice
  • Previous by thread: Re: Performance, Efficiency - Coding practice
  • Next by thread: Re: Performance, Efficiency - Coding practice
  • Index(es):
    • Date
    • Thread