C: This is Java, Right?
Writing code for this OS class reminds me of why I only write C++/java/ruby nowadays, rather than C.
Here’s a snippet from the top of one of my main files… I do enjoy making C languages that it is not!
// Look, I really like C++; I'll be needing these :-)
#define true (1==1)
#define false (!true)
typedef int bool;
//Debug mode toggle
const bool DEBUG_MODE=true; //See? Already using 'em!
#define true 1
#define false 0
That should be all you need. It’s basically like in Lisp–everything that isn’t nil (0) is true. Bool always seemed a little silly/unneeded if you can handle that idea.
Yeah, I know, but having functions that return bool ends up looking much cleaner rather than ones that say they return an int, but are used in Boolean logic somewhere else…