[postgis-devel] Use of "bool" in C

Paul Ramsey pramsey at opengeo.org
Wed Jun 22 12:02:24 PDT 2011


Swtich bools to ints, we should aim to be a pure C project... I wonder
what C++ bits we have around. We used to have to compile the
GEOS/PostGIS bridge code inside postgis before the GEOS c-api was
added. At this point we should be able to compile pure-C.

p.

On Wed, Jun 22, 2011 at 11:53 AM, Bryce L Nordgren <bnordgren at gmail.com> wrote:
> I stumbled across this when moving some functions from ./postgis to
> ./liblwgeom today. As it turns out, liblwgeom is compiled with gcc, whereas
> postgis is compiled with g++...and it makes a difference.
>
> bool is not a C keyword. Not even in C99. To use the C99 "bool" macro, you
> must include <stdbool.h>. The name of the builtin type is _Bool. Macros for
> true and false are TRUE and FALSE, respectively. I assume the only reason
> that postgis compiles at all is that g++ is doing the compiling, and C++
> rules apply.
>
> To make the code from the postgis directory compile with a C compiler (e.g.,
> in liblwgeom), I switched all "bool"s to "int"s.
>
> http://stackoverflow.com/questions/1608318/is-bool-a-native-c-type
>
> I suppose the relevant questions for devel are: Is PostGIS supposed to be a
> C project or are C++ constructs allowed?  Why are some C things compiled
> with C++?  How do you want to handle "bool"?  :) food 4 thot
>
> Bryce
>
> _______________________________________________
> postgis-devel mailing list
> postgis-devel at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-devel
>
>



More information about the postgis-devel mailing list