3 ms·
>If you understand how computers work it is extremely reliable bar none. On my processor, INT64_MAX + 1 will be INT64_MIN, a negative value. But the compiler i
by mahkoh 12y ago
>If you understand how computers work it is extremely reliable bar none.
On my processor, INT64_MAX + 1 will be INT64_MIN, a negative value. But the compiler is free to turn
for (int64_t i = 1; i > 0; i++) {
f(i);
}
into an infinite loop. Understanding how the computer works without reading about undefined behavior will make you fall into these kinds of traps.
- musername 12y agomissing overflow guards is just one of the big disappointments in c, if you have experience with asm for any popular processor atm.
- MrGando 12y agoWasn't part of the scope of the language. It's a doble edged sword, but I could see that being a good thing too. If you want raw speed, and know what you're doing, it could be OK not to have overflow guards.
- deleted 12y ago[deleted]