Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] Re: (PR#2461) bool type already exists
Home

[Freeciv-Dev] Re: (PR#2461) bool type already exists

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients:;
Subject: [Freeciv-Dev] Re: (PR#2461) bool type already exists
From: "Jason Short via RT" <rt@xxxxxxxxxxxxxx>
Date: Sun, 1 Dec 2002 05:02:01 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Sun, 2002-12-01 at 07:56, Per I. Mathisen via RT wrote:
> 
> On Sun, 1 Dec 2002, Jason Short via RT wrote:
> > Indicating that 'bool' was already defined in the system headers. It is
> > typedefed as unsigned char.
> >
> > I see two choices:
> >
> > - Use fc_bool instead of bool.That way we don't interfere with anyone
> > else.But people will forget to use it.  And IMO it is less readable.
> >
> > - Check for the 'bool' type in configure, and define HAVE_BOOL based on
> > this.The downside here is that the check may not be trivial, since we
> > don't know what header it might be in.
> 
> The solution to such problems is for configure to compile a very tiny
> program that uses bool, and if this works, define HAVE_BOOL.

Yes, but...

> The bigger problem may be that bool is typedef'ed to char instead of int.
> Wouldn't this cause some problems somewhere? Or at least lots of warnings?

Possibly warnings, but as long as all bools are chars there shouldn't be
problems.

The biggest problem I think is that we don't know where in the system
headers bool might be.  What header file does the test program #include?
Does it #include all of them?  How do we see to it that shared.h
#includes this header, without including everything else also?

This ended up being a problem in the beos case.  The header that bool
was in (be_prim.h, included from various other system headers) was
included by some files, but not by shared.h.  So just removing the
typedef from shared.h was not enough to force a compile.

jason




[Prev in Thread] Current Thread [Next in Thread]