[swift-users] Unsafe(Mutable)Pointer (suc)predecessor and advancedBy functions
Adrian Zubarev
adrian.zubarev at devandartist.com
Thu May 26 13:19:17 CDT 2016
It's also not clear sometimes exactly what "out of bounds" means - for example, you might have a big chunk of memory representing an array, and then you take a pointer to only part of that memory, representing a slice of the array. In this case you can write "out of bounds" of the slice, but the pointer type doesn't know that (because you are still within the range of the chunk of memory that you got from `UnsafeMutablePointer.memory()`).
True story. :D
Thank you for clarifying that to me, its a good example. Also the new pointer that I’ll get here won’t be a slice of an array just because `Memory` isn’t a slice. I’ll have to cast the pointer first, but I got the point here. ;)
One more thing:
- How does ARC work here when I create a new pointer to one of my allocated objects?
- Do I have 2 strong references to my main piece of memory?
--
Adrian Zubarev
Sent with Airmail
Am 26. Mai 2016 bei 20:07:36, Austin Zheng (austinzheng at gmail.com) schrieb:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160526/61b9bf3f/attachment.html>
More information about the swift-users
mailing list