this post was submitted on 06 Mar 2025
119 points (94.1% liked)
Programming
18606 readers
237 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities [email protected]
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Technically, 0 is false and anything else is true. !0 is 1, though, IIRC
As far as C goes, 1 is true and 0 is false.
In terms of POSIX exit codes, 0 is success and 1 is error.
I think more specifically for C, 0 is false and anything nonzero is true. Idk about NaN/inf.
True is anything other than zero in C.
Confidently incorrect.
Until you use exit codes, which flips the logic.
Jesus. I mistyped that horrendously to make a point about !0
I read my comment just now waking up and went wtf
~~That's what I meant so I've edited my comment to hopefully make that a bit clearer.~~ Having actually tested it, because in C++ I use true/false, it is 0 that equals false and anything else is true. You'll have to forgive my lack of clarity. It's 03:02 and I've had about 2 hours sleep tonight and won't be getting any more. Time for a coffee.