lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

Apple's programming language Swift is defined to raise an error on integer overflow:

"Unlike arithmetic operators in C, arithmetic operators in Swift do not overflow by default. Overflow behavior is trapped and reported as an error. To opt in to overflow behavior, use Swift’s second set of arithmetic operators that overflow by default, such as the overflow addition operator (&+). All of these overflow operators begin with an ampersand (&)."[1]

I wonder how much Apple's security experience shaped this feature. I also wonder if people are disabling it via the "-Ofast" compiler switch...

In any case, it's a notable exception in language design to "ints shall behave like C"--whatever that really means, anyway. :-)