3 ms·
"no language detects integer overflow by default because the processors make it slow" Not quite 'no'. Of course there are languages that that dynamically switc
by Someone 11y ago
"no language detects integer overflow by default because the processors make it slow"
Not quite 'no'. Of course there are languages that that dynamically switch to bignums, but I doubt that is what you mean.
Swift does detect overflow (by aborting, IIRC). https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/AdvancedOperators.html https://developer.apple.com/library/ios/documentation/Swift/...:
"If you try to insert a number into an integer constant or variable that cannot hold that value, by default Swift reports an error rather than allowing an invalid value to be created. This behavior gives extra safety when you work with numbers that are too large or too small."