Re: Stacking Code

From: Daniel A. Koepke (
Date: 01/17/00

On Mon, 17 Jan 2000, Damian Harouff wrote:

> Actually, if the stacking code changes int show to bool show, wouldn't
> I have to go through and change all the 1's and 0's or whatever they
> are to trues and falses?

C++ has a seperate 'bool' type and associated 'true' and 'false'
enumerated constants.  C does not.  CircleMUD defines bool with,

    #ifndef __cplusplus /* Not a C++ compiler */
    typedef char bool;

and defines TRUE and FALSE with,

    #ifndef FALSE /* C library doesn't define it. */
    #define FALSE 0

    #ifndef TRUE  /* C library doesn't define it. */
    #define TRUE (!FALSE)

And, as can easily be seen, conversion from/to char to/from int is
automatic.  In fact, C, as per C90/C89 (I haven't thought to look at it in
C99), even converts 'x' char literals to ints, so there is, in fact, no
difference between,

    int x;
    x = 'a';


    int x;
    x = (int) 'a';

Interesting, but mostly pedantic.


     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  |

This archive was generated by hypermail 2b30 : 04/10/01 PDT