• 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: stringWithCString:length deprecation
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stringWithCString:length deprecation


  • Subject: Re: stringWithCString:length deprecation
  • From: Graham Cox <email@hidden>
  • Date: Wed, 7 Oct 2009 23:07:18 +1100


On 07/10/2009, at 11:00 PM, Torsten Curdt wrote:

But that doesn't look like a real replacement. Shouldn't there be a

stringWithCString:length:encoding

What am I missing?

Pointers? Comments? Suggestions?


My guess is that in deprecating this they also took the opportunity to remove an API that really doesn't make sense. A string in C is defined to be terminated by a NULL byte, so any array of characters that contains NULL bytes that doesn't terminate them isn't a C string. Perhaps also it eliminates a possible source of buffer overruns that are known to be a security issue.

If you have an array of characters that contain NULL bytes you'll have to scan them into a string in a different way.

--Graham


_______________________________________________

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


References: 
 >stringWithCString:length deprecation (From: Torsten Curdt <email@hidden>)

  • Prev by Date: stringWithCString:length deprecation
  • Next by Date: Re: stringWithCString:length deprecation
  • Previous by thread: stringWithCString:length deprecation
  • Next by thread: Re: stringWithCString:length deprecation
  • Index(es):
    • Date
    • Thread