[swift-evolution] [Review] SE-0016 - Adding initializers to Int and UInt to convert from UnsafePointer and UnsafeMutablePointer

Jordan Rose jordan_rose at apple.com
Mon Mar 28 12:51:59 CDT 2016


> On Mar 28, 2016, at 4:47, fukurokujo via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> * What is your evaluation of the proposal?
> 
> -1
> 
>> * Is the problem being addressed significant enough to warrant a change to Swift?
> 
> No `UnsafePointer` and `UnsafeMutablePointer` already provide their address  as Int by their `hashValue` property (maybe add a dedicated `address` property that returns this???), this means it is already possible to do XOR on the addresses of two pointers. 

The use of 'hashValue' to get an address is not something you should rely on; it is very possible we'll decide to change the hashing algorithm for pointers in the future. But "I think a property would be a better API" is certainly still valid and useful feedback.

Jordan



More information about the swift-evolution mailing list