News for hackers. Stuff that matters.
Re:The Dark Side of C++ (2007) by asomiv on Sunday May 15, 2011 @06:21AM (#2549704)
#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.

Re:The Dark Side of C++ (2007) by tmp43522 on Sunday May 15, 2011 @06:46AM (#2549731)
#define FALSE 0 is the common one
Re:The Dark Side of C++ (2007) by asomiv on Monday May 16, 2011 @03:41AM (#2551926)
Doh, you're right. I had '#define FALSE 0' in my mind. '#define FALSE 1' actually is insane.
Re:The Dark Side of C++ (2007) by exDM69 on Monday May 16, 2011 @06:39AM (#2552143)
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.
Re:The Dark Side of C++ (2007) by kklimonda on Sunday May 15, 2011 @11:42AM (#2550114)
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.
Re:The Dark Side of C++ (2007) by asomiv on Monday May 16, 2011 @03:40AM (#2551925)
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.