Re: void and this

From: E. Robert Tisdale (E.Robert.Tisdale_at_jpl.nasa.gov)
Date: 10/10/03


Date: Fri, 10 Oct 2003 11:11:18 -0700

Dave Vandervies wrote:

> Gavin Deane wrote:
>
>>not do that. Doesn't C99 have a built in boolean type now?
>
> C99 has a built in boolean type (_Bool), as well as a standard header
> (<stdbool.h>) that defines macros for bool, true, and false.
>
> Since in practice you're unlikely to be able to avoid having to coexist
> with C90 for quite some time, this doesn't make it any easier to use
> bool in headers that have to be both C- and C++-clean.
> It's probably still best to use int and document that
> the value represents a boolean value for that.

This is *bad* advice.

C90 programmers should provide their own stdbool.h header file:

        #ifndef guard_stdbool_h
        #define guard_stdbool_h 1
        typedef int bool;
        const int false = 0;
        const int true = !false;
        #endif/*guard_stdbool_h */