> Le 3 juin 2016 à 17:11, Erica Sadun via swift-evolution 
> <[email protected]> a écrit :
> 
> Discussion has more or less drawn down. Are there any further significant 
> requests / issues that need addressing? Both standalone functions (my 
> recommended approach)  and the MemoryLayout<T> struct approach (alternative, 
> with reasons why I think it's not as ideal) are discussed in-proposal.
> 
> Pull Request: https://github.com/apple/swift-evolution/pull/350

Is there any need to consider the following common C sizeof() usage, which is 
currently illegal in Swift?

#if sizeof(MyType) != sizeof(Int)
# error "Someone added too much data to MyType"
#endif

It is not that I like fancy conditional compile, but having such compile time 
assertion is useful; at least in my day-time low-level C world. Most of the 
discussion seem to have been around sizeof() being more of a runtime function 
than a compiler directive; which would preclude being able to do compile time 
assertion to validate type size.

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

Reply via email to