Re:Night of a cascading failure
by ChrisSD on Monday January 21, 2019 @07:24PM
(#18964922)
The irony here is that the CPU will set the underflow making this trivial to detect in ASM with the `jb` instruction. The equivalent C++ would be something like:
As stated in the article, checking if an unsigned is less than 0 is a silly logic error but obviously one that is understandable to make. Still it's the sort of thing you'd expect automated tools would be able to catch.
[ Parent
| on HN ]
Re:Night of a cascading failure
by AstralStorm on Tuesday January 22, 2019 @12:02PM
(#18969816)
The problem is being written as <= 0. The compiler could complain "why aren't you just == 0 because it is unsigned" but that's probably enabled at -Wpedantic or such level.