Re: Stacking Code

From: Daniel A. Koepke (dkoepke@california.com)
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;
    #endif

and defines TRUE and FALSE with,

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

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

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';

and,

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

Interesting, but mostly pedantic.

-dak


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     |  http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html  |
     +------------------------------------------------------------+



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