50 ms·
Because when C was standardized in 1989, there were a few vendors that wanted to support non-two's-complement hardware, and C has been stuck with that ever sinc
by spc476 5y ago
Because when C was standardized in 1989, there were a few vendors that wanted to support non-two's-complement hardware, and C has been stuck with that ever since. But more to the point, even on two's-complement hardware, the CMP instruction doesn't care about the signedness, but it typically sets flags (for those CPUs that have flags) for both signed and unsigned results, and there are different conditional branches one can take for less-than, less-or-equal, greater-or-equal, and greater-than.
- flohofwoe 5y agoI often wished I had access to the flag bits in C (or at least a somewhat portable subset). Would be very handy for writing CPU emulators :)
- spc476 5y agoHaving written a CPU emulator [1], I don't thunk it would have been of much use. The Intel CPUs typically don't set the flags on a MOV, but Motorola CPUs typically do. [1] https://github.com/spc476/mc6809 https://github.com/spc476/mc6809