Re: bool: symbol name collision

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Bryan Henderson <bryanh(at)giraffe-data(dot)com>, tgl(at)sss(dot)pgh(dot)pa(dot)us, pgsql-bugs(at)postgresql(dot)org
Subject: Re: bool: symbol name collision
Date: 2010-05-11 20:15:17
Message-ID: 1273608917.32712.12.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On tis, 2010-05-11 at 14:42 -0400, Robert Haas wrote:
> I guess the question that comes to mind for me is how many other
> things fall into this category. We define a lot of symbols like int4
> and int32 that other people could also have defined, and I don't
> really want to s/^/pg/ all of them. If it's really only a question of
> renaming bool I could see doing it.

Well, anything that you link into the backend is most likely either
your own code or a library that has reasonable namespace standards. You
can't expect to be able to link together *two* unclean namespaces under
any circumstances. :-) But you could probably even work around that
with linker scripts, for example.

The issue at hand, however, is that bool is a reserved word in C++ and
therefore cannot easily be complained away. I think you could work
around that though, for example, by doing #define bool char before
including a PostgreSQL server header. It would depend on what you want
to do in the code, which is why an example would help.

Then again, in 2 out of 2 cases I checked, sizeof(bool) is 1 in C++, so
there is no actual issue. I know it doesn't have to be, but at least
for some people it's working now.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Bryan Henderson 2010-05-11 21:12:27 Re: bool: symbol name collision
Previous Message Tom Lane 2010-05-11 19:47:06 Re: bool: symbol name collision