Fixed-length C arrays need better handling
| Originator: | an00na | ||
| Number: | rdar://20824596 | Date Originated: | 05-May-2015 03:57 PM |
| Status: | Duplicate of 11353341 (Open) | Resolved: | |
| Product: | Developer Tools | Product Version: | Swift 1.2 |
| Classification: | Enhancement | Reproducible: | Not Applicable |
Summary:
Importing fixed-length C array as tuple makes it very hard to use. More specifically, because tuple does not support direct length access and iteration, the code to use such tuple-array is very unsafe and ugly:
let count = sizeofValue(cArray) / sizeofValue(cArray.0)
withUnsafePointer(&cArray.0) { (p) -> Void in
for var i = 0; i < count; ++i {
// code using p[i]
}
}
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!