Random832 <random...@fastmail.com>: > On Sat, Aug 20, 2016, at 03:50, Marko Rauhamaa wrote: >> 2'scomplement arithmetics is quite often taken advantage of in C >> programming. Unfortunately, with the castration of signed integers >> with the most recent C standards, 2's-complement has been dangerously >> broken. > > No part of any version of the C standard has ever allowed signed > integer overflow to work as defined behavior the way a generation of > programmers assumed it did.
Standard or no, it was widely taken advantage of and very useful. > What changed was advances in compiler optimization technology, not a > standards change. I wonder how much is gained by those optimizations. The loss to code quality is significant. What C standards have done is they have all but deprecated the use of signed integers. If you have to do integer arithmetics, cast everything into unsigned first. I think it's terrible that in C, x + y + z might not yield x + y + z even if all of { x, y, z, x + y + z } are inside the valid signed integer range. Marko -- https://mail.python.org/mailman/listinfo/python-list