saving octet-stream png file

Marko Rauhamaa marko at pacujo.net
Sat Aug 20 16:36:11 EDT 2016


Random832 <random832 at 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



More information about the Python-list mailing list