[swift-evolution] [Pitch] String revision proposal #1

Ben Rimmington me at benrimmington.com
Sun Apr 2 20:22:49 CDT 2017

Re: <https://github.com/apple/swift-evolution/pull/662>

### C String Interop

Will the `init(cString: UnsafePointer<UInt8>)` API be deprecated in Swift 4 mode?


It was added by SE-0107 to avoid unsafe pointer conversions:


### C Primitive Types

Will the `CChar` typealias be *unsigned* on some platforms?


Could some of those typealiases in CTypes.swift be moved to a C header, so that they're always imported as the correct types for each platform?

//===--- CTypes.h ------===//
typedef char               CChar;
typedef signed char        CSignedChar;
typedef unsigned char      CUnsignedChar;
typedef short              CShort;
typedef unsigned short     CUnsignedShort;
typedef int                CInt;
typedef unsigned int       CUnsignedInt;
typedef long               CLong;
typedef unsigned long      CUnsignedLong;
typedef long long          CLongLong;
typedef unsigned long long CUnsignedLongLong;
typedef float              CFloat;
typedef double             CDouble;

For example, CTypes.swift for 64-bit Windows currently has:
* `CLong     = Int32` versus `CUnsignedLong     = UInt`,
* `CLongLong = Int`   versus `CUnsignedLongLong = UInt64`.

More information about the swift-evolution mailing list