3 ms·
Iff in your language of choice a Boolean is always converted to a 1 or 0. In C, at least, that's not necessarily the case. That said, I'm always looking for th
by delinka 13y ago
Iff in your language of choice a Boolean is always converted to a 1 or 0. In C, at least, that's not necessarily the case.
That said, I'm always looking for the least branchy way of doing things.
- dbaupp 13y agoI was under the impression that the C standard does mandate that comparisons give 1 and 0 for true and false. (Other nonzero things are considered true, but a plain comparison won't return them.)
- userbinator 13y agoIt does. ISO/IEC 9899:1999, 6.5.8, p6 has this to say: "Each of the operators < (less than), > (greater than), <= (less than or equal to), and >= (greater than or equal to) shall yield 1 if the specified relation is true and 0 if it is false. The result has type int."