Re: bool: symbol name collision

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bryan Henderson <bryanh(at)giraffe-data(dot)com>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: bool: symbol name collision
Date: 2010-05-09 16:48:59
Message-ID: 1273423739.16789.2.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On sön, 2010-05-09 at 11:35 -0400, Tom Lane wrote:
> bryanh(at)giraffe-data(dot)com (Bryan Henderson) writes:
> > The interface header files for Postgres server extensions define "bool",
> > but that name is commonly used by other parts of user code, including
> > by standards (C99, C++). That causes, at best, compile failures.
>
> > If Postgres has to define a boolean type in public header files, it should
> > use a name that won't collide, like postgres_bool.
>
> Sorry, this isn't going to happen. It would break far too much existing
> code, and we consider building server extensions with C++ to be
> unsupported anyway.

Um, our code has

#ifndef __cplusplus

#ifndef bool
typedef char bool;
#endif

#ifndef true
#define true ((bool) 1)
#endif

etc.

so somehow it was once thought that it is worth supporting other
definitions of bool. Now to make this work in practice you probably
need to play some games with undefining and redefining and include file
order and so on, but I think it could work. In any case, it would be
better if Bryan could show us a concrete example that is causing
problems.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2010-05-09 16:58:06 Re: bool: symbol name collision
Previous Message Tom Lane 2010-05-09 16:31:24 Re: BUG #5455: two PGTYPES_NUM_OVERFLOWs