The language doesn't matter (C vs C++)

bool is a probably a typedef.
You need to include stdio.h


> -----Original Message-----
> From: wkwok [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, April 09, 2002 10:02 PM
> To: [email protected]
> Subject: RE: making a bool
> 
> 
> color.c: In function `get_color':
> color.c:43: `bool' undeclared (first use in this function)
> color.c:43: (Each undeclared identifier is reported only once
> color.c:43: for each function it appears in.)
> color.c:49: `COLOR' undeclared (first use in this function)
> color.c:49: `TRUE' undeclared (first use in this function
> 
> like i said i can't use the bool statment to define a 
> true/false senario i 
> think you missed the question.  I am atempting to write a 
> program not in 
> rom and i think bool for C (not C++) is not a reserved word 
> see what i 
> mean?  the code i have is simple
> 
> bool COLOR = FALSE;
> 
> 
> if(COLOR)
> {
>   color_write("You have color on");
>   return;
> }
> else
> {
>   puts("You do not have color on");
>   return;
> }
> 
> then i have the rest of the code working fine my question is 
> on making 
> bool thats all hopefuly seeing the code and the errors will help you 
> understand a little better. remember this is C not C++
> 
> On Tue, 9 Apr 2002, Jason Gauthier wrote:
> 
> > There's a bazillion ways to do this.
> > 
> > First. don't make a function called 'bool'.
> > it's a reserved word.
> > Second, why do you want to make a function that returns 
> true when you can
> > just check it in your code?
> > 
> > 
> > just do this:
> > 
> >   if (test == TRUE)
> >       do_this();
> >   else
> >       do_that();
> > 
> > Seriously, don't over complicate it :)
> > 
> > 
> > > -----Original Message-----
> > > From: wkwok [mailto:[EMAIL PROTECTED]
> > > Sent: Tuesday, April 09, 2002 9:46 PM
> > > To: [email protected]
> > > Subject: making a bool
> > > 
> > > 
> > > I know this isn't really a ROM question however i'm 
> trying to write a 
> > > pfile editor and I want to learn to use C to do it.  I know 
> > > C++ has a bool 
> > > function however i can't find it in C so i assume it isn't 
> > > there I was 
> > > wondering 2 things first is there a bool in C if not where is 
> > > the code in 
> > > ROM to make bool variables?
> > > 
> > > the code i thought up to make a bool function would be 
> > > something like...
> > > 
> > > int bool(char boolvalue)
> > > {
> > >   if(boolvalue==TRUE)
> > >           return 1;
> > >   else
> > >           return 0;
> > > }
> > > 
> > > seems pretty simple... ?
> > > 
> > > however would i be able to make it so i could actually type:
> > > 
> > > bool test;
> > > 
> > > if (test)
> > >   statments;
> > > 
> > > or would i have to do...
> > > 
> > >   char test;
> > >   test = FALSE;
> > >   bool(test);
> > > 
> > > witch just seems to be a big pain.
> > > 
> > > thanks in advance
> > >   Infernal
> > > 
> > > 
> > > 
> > > 
> > > -- 
> > > ROM mailing list
> > > [email protected]
> > > http://www.rom.org/cgi-bin/mailman/listinfo/rom
> > > 
> > 
> > 
> 
> 
> -- 
> ROM mailing list
> [email protected]
> http://www.rom.org/cgi-bin/mailman/listinfo/rom
> 

Reply via email to