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

2016-03-28 Thread Dan Raviv via swift-evolution
On Tue, Mar 22, 2016 at 11:35 PM, Chris Lattner via swift-evolution < swift-evolution@swift.org> 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

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

2016-03-28 Thread Russ Bishop via swift-evolution
One of the alternatives discussed in the proposal was adding mathematical operators to UnsafePointer so you can manipulate the pointers directly, such as XORing them, checking alignment, etc. I would very much prefer that we add operators and functions to UnsafePointer to express intent.

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

2016-03-27 Thread Russ Bishop via swift-evolution
Thinking through this proposal, I really favor the operator approach rather than adding these conversions so my vote is -1. (If you really know what you're doing you can already do an unsafeBitCast so this isn't a problem I've had in the real world) >Because some of these operations are

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

2016-03-23 Thread Richard Ross via swift-evolution
Just for note, an alternative that works right now (whether intentional or not) is this: let rawAddress: Int = UnsafeMutablePointer(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

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

2016-03-22 Thread Joseph Lord via swift-evolution
> On Mar 22, 2016, at 9:35 PM, Chris Lattner via swift-evolution > 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