glessard at tffenterprises.com
Fri Feb 19 15:03:11 CST 2016
In the currently planned version of the future, UnsafeMutablePointer loses its no-parameter initializer. I saw this as unnecessary, but it didn’t raise a red flag for me until trying to initialize a pthread_t in cross-platform code.
On Darwin, pthread_t maps to UnsafeMutablePointer:
public typealias pthread_t = __darwin_pthread_t
public typealias __darwin_pthread_t = UnsafeMutablePointer<_opaque_pthread_t>
On Linux, it does not (from /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h):
typedef unsigned long int pthread_t;
As a result, there is no longer an initializer that works in both cases without generating a deprecation warning.
Is the solution to fix this with new import overlays, or to reinstate UnsafeMutablePointer.init() ?
More information about the swift-dev