3 ms·
Slightly off topic, but why did 1 become the truthy value and not -1? Logical nots would then work. And youre still an inc/Dec away from the opposite.
by benj111 3y ago
Slightly off topic, but why did 1 become the truthy value and not -1?
Logical nots would then work.
And youre still an inc/Dec away from the opposite.
- never_inline 3y agoThat depends on a) Two's complement representation and b) Wraparound on arithmetic, which is still UB in low-level languages.
- benj111 3y agoOk. I used -1 as a short hand for 0b11111111(11111111(1111111111111111(11111111111111111111111111111111)))) Not doesn't rely on wrap around arithmetic. Wrap around arithmetic is only undefined for signed values. What platform doesn't wrap around signed integers? Just because c has some undefined behaviour, doesn't make it some natural law of the universe.