[swift-users] Mapping C semantics to Swift

Ken Burgett kenb at iotone.io
Thu May 19 12:00:30 CDT 2016


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?

-- 
Ken Burgett
Principal Software Engineer
Email: kenb at iotone.io
Office: 530.693.4449
Mobile: 831.332.6846
URL: www.iotone.co


More information about the swift-users mailing list