3 ms·
> I'm not sure how C is specifically to blame for something like int overflow C is not a good choice when safety is paramount. "The low-level nature of C and
by randomsearch 12y ago
> I'm not sure how C is specifically to blame for something like int overflow
C is not a good choice when safety is paramount.
"The low-level nature of C and C++ means that bit- and byte-level manipulation of objects is commonplace; the line between mathematical and bit-level operations can often be quite blurry. Wraparound behavior using unsigned integers is legal and well-defined, and there are code idioms that deliberately use it. On the other hand, C and C++ have undefined semantics for signed overflow and shift past bitwidth: operations that are perfectly well-defined in other languages such as Java."
http://www.cs.utah.edu/~regehr/papers/overflow12.pdf http://www.cs.utah.edu/~regehr/papers/overflow12.pdf