I was reading the GLFW library and I noticed they use GLFW_TRUE(1) and GLFW_FALSE(0). Now I've already seen that in other frameworks as well,making their own custom true/false identifiers. Is there any reason in creating your own custom true/false enums or classes in a framework? Does it make the code more readable for example? Is it a compatibility issue?
Another programmer speculated that they probably wouldn't want to #include <stdbool.h>
but that header is in fact very small and wouldn't overcomplicate dependencies
Is there any reason in creating your own custom true/false enums or classes in a framework?
stdbool.h
and _Bool
type)cppcheck
)Does it make the code more readable for example?
Is subjective. For someone, not for someone else.
Is it a compatibility issue?
Most probably yes.
In case of GLFW it was written for windows in ~2002 (according to this site https://www.glfw.org/changelog ). My guess the windows compiler the author used didn't have stdbool.h
. Either way, ask the author of the library.