> On May 19, 2016, at 10:00 AM, Ken Burgett via swift-users 
> <[email protected]> wrote:
> 
> I would like to know if a struct in Swift has any guarantee of contiguity, 
> like a struct in C.  I am attempting to port a C program that makes many 
> assumptions about the underlying semantics of C structs, and does things like 
> overlaying an array over the struct using a cast, and then performs and 
> cryptographic hashing of the entire struct by treating it as an array.
> 
> 1.  I a Swift struct contiguous?
> 
> 2.  If 1 above is true, can I somehow cast an array over the struct?

Swift structs have unspecified layout. If you depend on a specific layout, you 
should define the struct in C and import it into Swift for now.

-Joe
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to