Mail Archives: djgpp/2001/04/18/23:46:54
On Wed, 18 Apr 2001 08:28:43 GMT, gehok55 AT hotmail DOT com (Josh) wrote in
comp.os.msdos.djgpp:
> i dont seem to have a bool.h in any of my djgpp directories :|
> i added this
>
> typedef int bool;
> #undef TRUE
> #define TRUE 1
> #undef FALSE
> #define FALSE 0
>
> which fixes the problem (temporarily) .. but im a little worried. isnt
> C meant to have a bool type?
> thanks
>
> >One problem could be that you aren't #including
> >bool.h.
> >Hope that helps (short but sweet...)
> >
> >-Rafael Frongillo
>
> >>im having some troubles declaring boolean variables..
> >>where am i going wrong?
> >>
> >>typedef struct {
> >> int color;
> >> bool filled;
> >>}object;
> >>
> >>nasty stuff happens when i use the bool type.
>
>
>
> -Josh
> gehok55 AT hotmail DOT com
The 1999 update to the C standard added a new type called _Bool (the
combination of leading underscore and upper case letter puts it in the
namespace reserved for the implementation) which is similar, but not
identical to, the C++ type bool.
If you include the C99 standard header <stdbool.h>, it defines the
four macros bool, true, false, and __bool_true_false_are_defined.
If your gcc version supports _Bool, you can use this type without
including any header. If it supports _Bool and comes with the header
<stdbool.h> (or you can make your own <stdbool.h>, it's a pretty
simple header), then you can use the C99 macro bool.
Or you can wait for gcc 3 to be released, and ported to DJGPP. It's
due Real Soon Now, and should include a large increase in ISO C++ and
C99 features.
--
Jack Klein
Home: http://JK-Technology.Com
- Raw text -