[swift-evolution] [swift-evolution-announce] [Review] SE-0184: Unsafe[Mutable][Raw][Buffer]Pointer: add missing methods, adjust existing labels for clarity, and remove deallocation size
atrick at apple.com
Thu Sep 7 12:26:59 CDT 2017
> On Sep 6, 2017, at 10:15 PM, Taylor Swift <kelvin13ma at gmail.com> wrote:
> okay so I think so far what’s been agreed on is
> 1. rename “Bytes” to “Memory” in the raw pointer API. Note: this brings the `copyBytes<C>(from:)` collection method into the scope of this proposal
> 2. change raw offsets to be in terms of bytes, not typed strides. This argument will be called `atByteOffset:` and will only appear in UnsafeMutableRawBufferPointer. “at:” arguments are no longer needed in UnsafeMutableRawPointer, since we can just use pointer arithmetic now.
> 3. move UnsafeMutableBufferPointer’s `at:` arguments to the front of the parameter list. mostly cause any pointer arithmetic happens in the front so structurally we want to mirror that.
> 4. add dual (to:) single element initializers and assigners to UnsafeMutablePointer, but not UnsafeMutableRawPointer because it’s apparently not useful there. `UnsafeMutableRawPointer.initializeMemory<T>(as:repeating:count:)` still loses its default count to prevent confusion with its buffer variant.
> 5. memory deallocation on buffer pointers is clearly documented to only be defined behavior when the buffer matches a whole heap block.
Yay for all 5.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution