On Tue, 16 Feb 2010 10:36:04 -0500, Daniel Keep
<daniel.keep.li...@gmail.com> wrote:
It's fun to note that one of the fixes the author proposes in the
article was actually shown to itself be wrong... nearly two years later.
Clearly, knowing that computers use two's complement fixed-width integer
arithmetic is insufficient to write correct code. To believe otherwise
is to believe that humans are infallible.
Yes, but in this case, the solution was incorrect for a small number of
inputs (arrays with length > 2^30).
For negation of unsigned values, the code is incorrect for all inputs
except for zero.
Appropriately, one will notice something is wrong sooner than a decade. I
would postulate they should know instantaneously because the compiler
should reject it :)
-Steve