Many Foundation APIs use Int8 instead of CChar when representing C strings, e.g.:
var UTF8String: UnsafePointer <Apple Developer Documentation <Apple Developer Documentation; { get }
I don’t know if/when Swift will be ported to a platform where the character type is unsigned but perhaps it would be good to update these to take CChar instead?
On Jan 2, 2016, at 8:28 PM, Luke Howard via swift-corelibs-dev <swift-corelibs-dev@swift.org> wrote:
Many Foundation APIs use Int8 instead of CChar when representing C strings, e.g.:
var UTF8String: UnsafePointer <UnsafePointer | Apple Developer Documentation <Int8 | Apple Developer Documentation; { get }
I don’t know if/when Swift will be ported to a platform where the character type is unsigned but perhaps it would be good to update these to take CChar instead?
— Luke
I’m not really sure why it’s imported to Swift as an unsafe pointer to Int8 anyway. The Objective-C code uses char:
No C strings import as UnsafePointer<CChar> for some reason; they all import as Int8
e.g.
public func pthread_setname_np(_: UnsafePointer<Int8>) -> Int32
···
On Jan 4, 2016, at 1:20 PM, Tony Parker via swift-corelibs-dev <swift-corelibs-dev@swift.org> wrote:
Hi Luke,
On Jan 2, 2016, at 8:28 PM, Luke Howard via swift-corelibs-dev <swift-corelibs-dev@swift.org <mailto:swift-corelibs-dev@swift.org>> wrote:
Many Foundation APIs use Int8 instead of CChar when representing C strings, e.g.:
var UTF8String: UnsafePointer <UnsafePointer | Apple Developer Documentation <Int8 | Apple Developer Documentation; { get }
I don’t know if/when Swift will be ported to a platform where the character type is unsigned but perhaps it would be good to update these to take CChar instead?
— Luke
I’m not really sure why it’s imported to Swift as an unsafe pointer to Int8 anyway. The Objective-C code uses char: