View Single Post
Old June 17, 2010, 01:40   #37
nppangband
NPPAngband Maintainer
 
Join Date: Dec 2008
Location: Stat Gain, Angband
Posts: 926
nppangband is on a distinguished road
Quote:
Originally Posted by d_m View Post
Current Angband coding guidelines target C89, so C99's bool is not available.

It's worth asking Takk about this, I think.
Line 155 of h-basic.h has this:

/* C++ defines its own bool type, so we hack around it */
#undef bool
#define bool bool_hack

Then a couple lines later, there is this:

/*
* Use a real bool type where possible
*/
#ifdef HAVE_STDBOOL_H

#include <stdbool.h>

#define TRUE true
#define FALSE false

#else

/* Use a char otherwise */
typedef char bool;

and around line 50 of the same file, there is this....about STDBOOL...

/*
* Using C99, assume we have stdint and stdbool
*/
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
# define HAVE_STDINT_H
# define HAVE_STDBOOL_H
# endif

and at that point my little brain explodes..... I have no clue what is going on there. I assume it is an attempt to standardize the definition of bool for certain operating systems and compilers. But I doubt I could even understand it if somebody tried to explain it to me.
nppangband is offline   Reply With Quote