• 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: Public API method naming for NSString * / const char * parameters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Public API method naming for NSString * / const char * parameters


  • Subject: Re: Public API method naming for NSString * / const char * parameters
  • From: Daniel DeCovnick <email@hidden>
  • Date: Mon, 03 Mar 2014 18:27:12 +0100

Sure, but the consumer of the framework is still an Objective-C application or framework, which is going to be using NSStrings for everything else already and presumably up to the boundary with this framework. Why make the consumer do the conversion? If the method is going to be called “a lot”, the framework can cache UTF8 representations, just like the consumer was going to have to do anyway.

Daniel

On Mar 3, 2014, at 5:18 PM, Jens Alfke <email@hidden> wrote:

>
> On Mar 3, 2014, at 7:19 AM, Daniel DeCovnick <email@hidden> wrote:
>
>> Are these selectors bound to library functions that must take char *’s and you can’t afford the overhead of a second method dispatch or function call
>
> The OP is working with Mono, a C# runtime, so I’m sure the glue to it takes C strings.
>
> The overhead of using NSString would be greater than just a method dispatch. Converting an NSString to a UTF-8 C string will often require allocating memory, depending on the internal representation the NSString is using and whether it contains non-ASCII characters. (NSStrings are internally stored as either UTF-16 or MacRoman, not UTF-8.)
>
> —Jens

_______________________________________________

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: 
 >Public API method naming for NSString * / const char * parameters (From: "email@hidden" <email@hidden>)
 >Re: Public API method naming for NSString * / const char * parameters (From: Daniel DeCovnick <email@hidden>)
 >Re: Public API method naming for NSString * / const char * parameters (From: Jens Alfke <email@hidden>)

  • Prev by Date: Re: NSOperation Dispatch Thread Soft Limit
  • Next by Date: Re: Public API method naming for NSString * / const char * parameters
  • Previous by thread: Re: Public API method naming for NSString * / const char * parameters
  • Next by thread: Re: notification when device change in /dev
  • Index(es):
    • Date
    • Thread