How can I condition on the size of Int?

That's interesting. If possible, we'd ideally suppress the warning since the intention here is pretty clear.

That said, there is an alternative spelling which doesn't generate the warning:

if MemoryLayout<Int>.size == 8 {
    print("64-bit")
} else {
    print("32-bit")
}

This yields the same optimized binary.

3 Likes