Re: bool: symbol name collision - Mailing list pgsql-bugs

From Greg Stark
Subject Re: bool: symbol name collision
Date
Msg-id v2r407d949e1005091802i9c311124j7a2899cdd07d26ef@mail.gmail.com
Whole thread Raw
In response to Re: bool: symbol name collision  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: bool: symbol name collision  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-bugs
On Sun, May 9, 2010 at 6:04 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Huh? =A0We build just fine on C99 compilers, AFAIK. =A0Or are you saying
> that we should try to adopt <stdbool.h>'s definition of bool? =A0The
> problem there is, again, that we don't know what width that will be.

No, I'm saying we should use something like pgbool so that users can
compile code that uses stdbool.h in a c99 environment.

This would break any existing modules which use bool to refer to the
postgres bool. It wouldn't be hard to replace bool with pgbool in
those modules, and if they want to work with multiple versions of
postgres then they can add a #ifndef bool #define bool pgbool and be
done.

It's hardly our highest priority but it seems a reasonable course
given that c99 is becoming quite standard. It's hardly as invasive as
what would be needed to be c++ safe. I'm not sure whether our include
files have an non-c99 inline uses which would be harder to deal with.

I don't see any other conflicts offhand that would create problems
using a c99 compiler to build server modules. It's quite annoying and
sad that they added "bool" to c99 since otherwise it would just be a
drop-in replacement with extra functionality and very low risk of
conflicts. Instead they virtually guaranteed conflicts with any large
software over a single define.



--=20
greg

pgsql-bugs by date:

Previous
From: bryanh@giraffe-data.com (Bryan Henderson)
Date:
Subject: Re: bool: symbol name collision
Next
From: Takahiro Itagaki
Date:
Subject: Re: BUG #5450: system lacked sufficient buffer space, or because a queue was full, could not perform the operation