3 ms·
Really struggling what your point is. I didn't say that undefined behavior expose hardware characteristics, though I suppose for a lot of cases it really does
by tjoff 5y ago
Really struggling what your point is.
I didn't say that undefined behavior expose hardware characteristics, though I suppose for a lot of cases it really does - but the compiler won't assume so. I said that C exposes hardware characteristics. And C also has several architectures in mind.
Signed integer overflow is trivial on a two-complement system but not necessarily on others, so the lowest common denominator dictates what can be done. If the behavior is different or expensive you might shift that decision to the programmer.
Negating the sign of INT_MIN isn't cheap to do in a two-complement system.
- tialaramex 5y ago> I said that C exposes hardware characteristics. Nonsense isn't a characteristic of the hardware. The hardware has very clearly defined behaviour, but C chooses not to expose that.
- tjoff 5y agoWell, how do you expose something that is different on different architectures? Maybe not define it? Anyway, doesn't seem like you are even trying to understand. No worries, I won't bother.
- tialaramex 5y agoC is full of things that are different from one architecture to the next but don't have Undefined Behaviour. Instead they are: "Implementation Defined".
- deleted 5y ago[deleted]