[swift-evolution] [Pitch] Swift needs fixed-size array
Anders Kierulf
anders at smartgo.com
Mon Apr 17 14:18:23 CDT 2017
> On Apr 17, 2017, at 12:37 PM, Karl Wagner <razielim at gmail.com> wrote:
>
>> On 17 Apr 2017, at 19:52, Anders Kierulf via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>
>> Proposal: UnsafeMutablePointer almost provides what I need. However, it can only allocate memory on the heap, or it can take a given blob of memory and interpret it as something else. What’s missing is a way to allocate typed memory of a certain size on the stack or in a struct. For example, something like this, with support for subscripts, limited to value types:
>
> What happens if you use alloca?
Doesn’t look like using alloca is recommended in Swift: https://bugs.swift.org/browse/SR-323
Also, while it might be used as a hack for stack allocations, it wouldn’t allow inclusion into structs.
Anders
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170417/cc36407b/attachment.html>
More information about the swift-evolution
mailing list