Just for note, an alternative that works right now (whether intentional or not) is this:
let rawAddress: Int = UnsafeMutablePointer<UInt8>(nil).distanceTo(myPointer) This gives the distance in bytes (so on 95% of all platforms, the raw address). It currently isn't clear that this is how you can accomplish this in swift, so I'm +1 on the proposal. -- Richard > On Mar 22, 2016, at 8:24 PM, Joseph Lord via swift-evolution > <[email protected]> wrote: > >> On Mar 22, 2016, at 9:35 PM, Chris Lattner via swift-evolution >> <[email protected]> wrote: >> >> Hello Swift community, >> >> The review of "Adding initializers to Int and UInt to convert from >> UnsafePointer and UnsafeMutablePointer" begins now and runs through March >> 25th. The proposal is available here: >> >> >> https://github.com/apple/swift-evolution/blob/master/proposals/0016-initializers-for-converting-unsafe-pointers-to-ints.md > > I give the concept a +1. Swift should support dangerous actions but should > make them clear and obvious. I do think that there is room to improve the > argument label. There are two issues with "bitPattern" that concern me: > 1) it should be clear that it will be the bitPattern of the pointer itself > not whatever the pointer refers to. > 2) it doesn't indicate the danger of using the results of this > > I don't have a great alternative to bitPattern but maybe something like: > "rawMemoryAddress" > > I've read the proposal and given it a little bit of thought but have not yet > read preceding or recent comments. > > Joseph > _______________________________________________ > swift-evolution mailing list > [email protected] > https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.swift.org_mailman_listinfo_swift-2Devolution&d=CwIGaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=Ezje1IF3xGXfUMfsj4fBc7oM7BcJys1dhQ6psfXzLMU&m=i019xuJ4IOUV9q48MCnS9R5K_9HDaAIqAAGCp9-HX_k&s=W8720bY71AVSU3_XbLpWfFEh9Vmh9qMh1YTnodVcUHs&e= > _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
