[swift-dev] What can you change in a fixed-contents struct?

Jordan Rose jordan_rose at apple.com
Wed Sep 6 12:10:24 CDT 2017



> On Sep 5, 2017, at 18:37, Nevin Brackett-Rozinsky via swift-dev <swift-dev at swift.org> wrote:
> 
> On Tue, Sep 5, 2017 at 6:08 PM, Slava Pestov via swift-dev <swift-dev at swift.org <mailto:swift-dev at swift.org>> wrote:
> We expect that “define your struct in C” is still the way to go for layout compatibility with other languages and systems.
> 
> Are there plans (however tentative) to eventually make it possible to specify the exact memory layout of a struct in Swift?
> 
> It seems like something we will have to tackle in order for Swift to become a serious systems-level programming language.

There's nothing inherently wrong with having a 'packedLayout' attribute or similar (as long as the compiler can enforce alignment requirements for non-trivial types), but neither is it urgent since you can do the same thing in C. It's a feature that can be added at any time, just not to existing fixed-contents structs.

Jordan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-dev/attachments/20170906/1feb2338/attachment.html>


More information about the swift-dev mailing list