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: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2461) bool type already exists
From: "Raimar Falke via RT" <rt@xxxxxxxxxxxxxx>
Date: Sun, 1 Dec 2002 11:04:44 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Sun, Dec 01, 2002 at 10:40:28AM -0800, Per I. Mathisen via RT wrote:
> 
> On Sun, 1 Dec 2002, Raimar Falke via RT wrote:
> > Please try the attached patch.
> 
> Not good enough for BeOS, since it seems to read its bool typedef from
> <posix/be_prim.h> for its posix layer. Including stdbool.h gives an
> error, just as if typedef'ing it ourselves.

Can you post this posix/be_prim.h file?

> So we may need to put
> 
> #if __BEOS__
> #include <posix/be_prim.h>
> #else
> ... everything else ...
> #endif
> 
> in there as well.

Looks so. So much for the standard-compliance.

> +#undef__bool_true_false_are_defined
> +#define bool fc_bool
> +#define __bool_true_false_are_defined 1
> +typedef unsigned int fc_bool;
> 
> What's the point with these?

       7.1.7  Boolean type and values <stdbool.h>

       [#1] The header  <stdbool.h>  defines  one  type  and  three
       macros.

       [#2] The type is

               bool

       which is an integer type that promotes to  int  or  unsigned
       int,  and  that is suitable to be used as the type of a bit-
       field.  A bit-field of any width  and  type  bool  shall  be
       capable for representing the value 1.138


       __________

       138. The  traditional choice for type bool has been int, but
           this  is  not  a  requirement  of   this   International
           Standard.   Other available choices include, but are not
           limited to, char, unsigned int, and an enumeration type.

           If an enumeration type is chosen, the names of its  true
           and  false  members  are "masked" by the macros true and
           false, but the member names might be  available  to  the
           debugger:

           typedef enum { false=0, true=1 } bool;
           #define false 0
           #define true 1

           The type is  suitable  for  bit-fields  if  it  is  int,
           unsigned  int,  signed  int,  or some type allowed by an

       [#3] The macros are

               true

       which expands to the decimal constant 1,

               false

       which expands to the decimal constant 0, and

               __bool_true_false_are_defined

       which expands to the decimal constant  1.   The  macros  are
       suitable for use in #if preprocessing directives.


> +#define TRUE true
> +#define FALSE false
> 
> Please undefine first to be on the safe side.

Ok.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "Any sufficiently advanced technology is indistinguishable from magic."
    -- Arthur C. Clarke



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