MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/teqb37/static_bool_iscrazymurderingrobot_false/i0v20wd/?context=3
r/ProgrammerHumor • u/speckz • Mar 15 '22
257 comments sorted by
View all comments
Show parent comment
1
Never ever do == true.
== true
In C, every non-zero expression is considered true and since C has no native type for booleans, stdbool.h defines flase als 0 and true as ~false. So most values that eval as true in a boolean expression are actually != true.
flase
true
~false
!= true
Always go for != false.
!= false
View all comments
Show parent comment
1
u/SnakeBDD Mar 16 '22
Never ever do
== true.In C, every non-zero expression is considered true and since C has no native type for booleans, stdbool.h defines
flaseals 0 andtrueas~false. So most values that eval as true in a boolean expression are actually!= true.Always go for
!= false.