Your Personal Truth
by Remy Porter
in CodeSOD
on 2020-07-07
There are still some environments where C may not have easy access to a stdbool
header file. That's easy to fix, of course. The basic pattern is to typedef
an integer type as a boolean type, and then define some symbols for true and false. It's a pretty standard pattern, three lines of code, and unless you insist that FILE_NOT_FOUND
is a boolean value, it's pretty hard to mess up.
Julien H was compiling some third-party C code, specifically in Visual Studio 2010, and as it turns out, VS2010 doesn't support C99, and thus doesn't have a stdbool
. But, as stated, it's an easy pattern to implement, so the third party library went and implemented it: