delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/04/19/00:00:17

From: Jack Klein <jackklein AT spamcop DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: bool type
Message-ID: <f5nsdt4uc2jotdqq5hsfmqdarkfqqj2juf@4ax.com>
References: <20010418005914 DOT 7485 DOT qmail AT web13308 DOT mail DOT yahoo DOT com> <3add4e25 DOT 65909932 AT news DOT dingoblue DOT net DOT au>
X-Newsreader: Forte Agent 1.8/32.548
MIME-Version: 1.0
Lines: 57
Date: Thu, 19 Apr 2001 03:40:35 GMT
NNTP-Posting-Host: 12.75.150.213
X-Complaints-To: abuse AT worldnet DOT att DOT net
X-Trace: bgtnsc06-news.ops.worldnet.att.net 987651635 12.75.150.213 (Thu, 19 Apr 2001 03:40:35 GMT)
NNTP-Posting-Date: Thu, 19 Apr 2001 03:40:35 GMT
Organization: AT&T Worldnet
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

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 -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019