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

From Peter Eisentraut
Subject Re: bool: symbol name collision
Date
Msg-id 1273608917.32712.12.camel@vanquo.pezone.net
Whole thread Raw
In response to Re: bool: symbol name collision  (Robert Haas <robertmhaas@gmail.com>)
List 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.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: bool: symbol name collision
Next
From: Robert Haas
Date:
Subject: Re: bool: symbol name collision