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

Re: Please don't do this (code fragment)

Torsten Landschoff <torsten@debian.org> writes:
> elf@florence.buici.com wrote:

>> Moreover, the original depends on the fact that (MAX_INT + 1) < 0
>> which, though true, is a guaranteed result.  Were I to be running a
>> 64
> ... is not a guaranteed ...
> I yet have to see a machine that does not use two's complement
> for integer arithmetic.

Even if you don't care about weird platforms, "x > -1" is a
ridiculously obscure test in this context; to achieve the same effect
it would be much clearer to make x unsigned and do "x <=

(Better still, redesign the program to have non-idiotic error


Reply to: