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
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.
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
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
> 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