News for hackers. Stuff that matters.
Re:Let's Destroy C by kaetemi on Thursday January 30, 2020 @03:39AM (#22189864)
Most cases I've seen accept anything as true as long as the LSB is 1, and quite strictly 0 as false. Everything else is up in the air. The value -1 is definitely true. :)
Re:Let's Destroy C by ufo on Thursday January 30, 2020 @10:14AM (#22191843)
One could say that -1 is the truest true, because its two's-complement representation has the most 1s.
Re:Let's Destroy C by kaetemi on Friday January 31, 2020 @05:32AM (#22200581)
True.
Re:Let's Destroy C by shakna on Thursday January 30, 2020 @10:56AM (#22192263)
> The value -1 is definitely true

Except when being used as a comparison to any of the std utilities.

Re:Let's Destroy C by syockit on Thursday January 30, 2020 @05:00PM (#22196241)
As far as I know, std library specifically uses the word "nonzero" in the documentation to denote non-false value. Therefore you should be using !, &&, || for any boolean ops, but never == nor !=