bool: symbol name collision - Mailing list pgsql-bugs

From bryanh@giraffe-data.com (Bryan Henderson)
Subject bool: symbol name collision
Date
Msg-id 118.bryanh@giraffe-data.com
Whole thread Raw
Responses Re: bool: symbol name collision
List pgsql-bugs
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.  Alternatively, it might
just #include <stdbool.h>, if it can depend upon a C99 compiler.

Incidentally, this collision is particularly heinous because structures that
are part of the server extension interface have "bool" members, and if the
server and user program are compiled with bools of different sizes,
disaster occurs.  Postgres's bool is one byte; often, bool is 4 bytes.

I saw this in Postgres 8.4.3.

--
Bryan Henderson                                   San Jose, California

pgsql-bugs by date:

Previous
From: bryanh@giraffe-data.com (Bryan Henderson)
Date:
Subject: reference to undefined macro _MSC_VER
Next
From: Jasen Betts
Date:
Subject: Re: BUG #5448: psql \set does not terminate if variable is referenced recursively