#define FALSE 1 is not that uncommon in C because C in its infinite wisdom doesn't have true/false literals so people have to invent those by themselves.
Glib goes into great lengths to avoid namespace conflicts so it defines the GBoolean type and G_TRUE/G_FALSE. Whether that really is better than #define TRUE/FALSE, I don't know.
#define FALSE 0 is the common one
Doh, you're right. I had '#define FALSE 0' in my mind. '#define FALSE 1' actually is insane.
In C99 #include <stdbool.h> has the type bool and the constants true and false (even in the "freestanding" flavor). Of course this doesn't save you if you are dealing with old/non-conformant compilers and/or legacy codebases.
It actually defines TRUE and FALSE, and not G_TRUE/G_FALSE. But it does indeed define the gboolean type - it does make code easier to read.
Re:The Dark Side of C++ (2007)
by burgerbrain on Sunday May 15, 2011 @11:49AM
(#2550127)
People don't have to invent them, and it's generally annoying as hell when they chose to.
So then what are they supposed to do, require a library X which has already invented them, while your app is using library Y which already does the same thing as X?
Re:The Dark Side of C++ (2007)
by burgerbrain on Monday May 16, 2011 @06:10PM
(#2554391)
Use 0 and 1, like everyone else. Those #defines are just meaningless syntactical sugar that get in the way.
I'm not sure why after finding that he decided to file a bug report rather that not touch any of that code.