common.h: tweak the qboolean and NULL definitions for __cplusplus. from uhexen2.

git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@176 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
Ozkan Sezer 2010-05-31 12:10:25 +00:00
parent 12e4aa6caa
commit 23bc72554f
1 changed files with 15 additions and 2 deletions

View File

@ -31,8 +31,17 @@ typedef unsigned char byte;
#undef true
#undef false
typedef enum {false, true} qboolean;
#if defined(__cplusplus)
/* do NOT use the bool of C++ because some structures have boolean and they
* expect it to be 4 bytes long. as a hack, typedef it as int. */
/* DO HOPE that the compiler built-ins for true and false are 1 and 0 ... */
typedef int qboolean;
#else
typedef enum {
false = 0,
true = 1
} qboolean;
#endif
//============================================================================
@ -73,8 +82,12 @@ void InsertLinkAfter (link_t *l, link_t *after);
//============================================================================
#ifndef NULL
#if defined(__cplusplus)
#define NULL 0
#else
#define NULL ((void *)0)
#endif
#endif
#define Q_MAXCHAR ((char)0x7f)
#define Q_MAXSHORT ((short)0x7fff)