Skip site navigation (1) Skip section navigation (2)

Re: bool: symbol name collision

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Bryan Henderson <bryanh(at)giraffe-data(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: bool: symbol name collision
Date: 2010-05-10 01:02:39
Message-ID: v2r407d949e1005091802i9c311124j7a2899cdd07d26ef@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-bugs
On Sun, May 9, 2010 at 6:04 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> Huh?  We build just fine on C99 compilers, AFAIK.  Or are you saying
> that we should try to adopt <stdbool.h>'s definition of bool?  The
> 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.



-- 
greg

In response to

Responses

pgsql-bugs by date

Next:From: Takahiro ItagakiDate: 2010-05-10 03:14:15
Subject: Re: BUG #5450: system lacked sufficient buffer space, or because a queue was full, could not perform the operation
Previous:From: Bryan HendersonDate: 2010-05-09 17:37:10
Subject: Re: bool: symbol name collision

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group