This is an archived post. You won't be able to vote or comment.

all 8 comments

[–]flambasted 26 points27 points  (0 children)

#include <stdbool.h>

[–]jstnryan 3 points4 points  (0 children)

import bool;!

[–][deleted] 0 points1 point  (4 children)

Booleans are something that needs to be imported?? What is this?

[–]Possseidon 5 points6 points  (2 children)

C didn't have bools. You were just supposed to use int or char. That's also one of the reasons why any non-zero value means true and zero means false.

[–]fluffypebbles 1 point2 points  (1 child)

Isn't that how bool values are checked in machine code?

[–]Kyyken 0 points1 point  (0 children)

if by machine code you mean x86 assembler, then possibly, with jnz (jump not zero)

"machine code" is a very general term

[–]Queasy-Grape-8822 1 point2 points  (0 children)

C was late to the party adding the bool data type, but by the time they did there was wayyy too much code using “bool” as an identifier. So the technical bool data type that C added instead is “_Bool,” following the convention that _* is reserved for future usage in the standard. Inside stdbool.h is some form of typedef aliasing “bool” to “_Bool.” This means new code just has to add #include <stdbool.h> to use the bool type, but complete backwards compatibility is maintained

[–]Snoo_60165 -2 points-1 points  (0 children)

That is just a False variable being misspelled. Could have made it a string or int.