[swift-users] [swift-dev] Guarantees of Tuples as Fixed Sized (stack allocated) Arrays

Jordan Rose jordan_rose at apple.com
Tue May 2 15:38:56 CDT 2017

> On Apr 28, 2017, at 16:28, John McCall via swift-users <swift-users at swift.org> wrote:
>> On Apr 28, 2017, at 7:03 AM, Johannes Weiss via swift-dev <swift-dev at swift.org <mailto:swift-dev at swift.org>> wrote:
>> Hi swift-users,
>> (sorry for the cross post to swift-dev, but wasn't sure where it belongs)
>> I tried to find guarantees about the memory layout Swift tuples but couldn't find anything. The reason I ask is because I'd like to use them as fixed sized (stack allocated) arrays. I'm pretty sure they're actually not guaranteed to be stack allocated but highly likely I assume :).
> Tuples are guaranteed to use a standard C-style layout wherever that layout is ABI-observable, e.g. when you construct an UnsafePointer to one.

Ah, is this true for non-homogeneous tuples? I thought we only guaranteed it for homogeneous ones.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20170502/5f832622/attachment.html>

More information about the swift-users mailing list