4 ms·
That doesn't really follow. Most of the time, like behavior of integer overflow, the program doesn't really care (as in the machine language version doesn't ref
by tedunangst 12y ago
That doesn't really follow. Most of the time, like behavior of integer overflow, the program doesn't really care (as in the machine language version doesn't reflect a specific desire for wrapping behavior, especially for signed values). The naive C version is good enough. And of course, it's always possible to even more carefully disassemble and preserve semantics, though this is usually undesirable because it obscures what's relevant.
- yoklov 12y agoSigned wrapping behavior is well-defined in the machine language for every architecture that ever existed (or at least, that I've ever heard of). If the assembly code depends on the wrapping behavior and you translated that to C, you'd get C code that depends on the behavior of signed overflow, which the compiler is free to completely remove, no matter your target. This is a somewhat extreme case, as code that depends on the behavior of signed overflow is rare, but there's a lot of things that are perfectly well specified by the architecture, but that C leaves undefined.