On Tue, 9 Apr 2002, Steve Boleware wrote:

> > I am including stdio.h
> > if it's a "keyword" like you said wouldn't it be part of the language?
> > how would i typedef it?
> >
> > what would i typedef it as?
> >
> > not trying to seem rude if i do i just don't understand
>
> if you have included stdio.h and there is no bool type defined,
> you are probably coding in windows... in that case you would use
> something like the following:

That's odd.. If I include stdio.h, there is no bool type defined...
And I'm not coding in Windows, but in Linux!

> #if defined(WIN32)
> //needed in Win32. For some reason it is not defined by default -SB
> typedef unsigned char   bool;
> #endif

That "some reason it is not defined by default" would be because there
is no "bool" type in C, or in any of the standard C header files.
(As a side note, there are some header files that define a bool type,
but none of the standard header files should.  That would cause
all sorts of problems with name collisions since "bool" is such a
common name people use).

I believe the new spec for C has a boolean type called _Bool or something
like that.  But the old spec did not define any boolean type, and
it's still not "bool".


Now are you sure you're talking C and not C++?  If you're compiling
your code with g++ (or any C++ compiler for that matter), there will
be a bool data type defined.  But if you're compiling with a C compiler,
there will not be.


Dennis


Reply via email to