Re: Public API method naming for NSString * / const char * parameters
Re: Public API method naming for NSString * / const char * parameters
- Subject: Re: Public API method naming for NSString * / const char * parameters
- From: Jens Alfke <email@hidden>
- Date: Mon, 03 Mar 2014 08:18:29 -0800
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