[swift-evolution] Pitch: Improved Swift pointers
Andrew Trick
atrick at apple.com
Fri Jul 14 13:34:50 CDT 2017
> On Jul 14, 2017, at 11:27 AM, Michael Ilseman <milseman at apple.com> wrote:
>
>> I also have to say it’s not common to deallocate something in Swift that you didn’t previously allocate in Swift.
>>
>
> I’m not sure it is even defined to use `deallocate` on memory that wasn’t `allocated` in Swift. Andy, thoughts here? Perhaps more clarity in deallocate’s documentation is needed?
If my memory is correct, Swift’s `deallocate` requires a pointer that was allocated via Swift’s `allocate`.
What’s missing from the docs I suppose is the fact that we now have a set of Swift allocate/deallocate entry points, which are of course compatible as long as the user keeps track of the capacity and alignment. IMO the buffer pointer API should alleviate that responsibility from the user.
-Andy
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170714/b128cdbc/attachment.html>
More information about the swift-evolution
mailing list