bool: symbol name collision

From: bryanh(at)giraffe-data(dot)com (Bryan Henderson)
To: pgsql-bugs(at)postgresql(dot)org
Subject: bool: symbol name collision
Date: 2010-05-08 23:51:17
Message-ID: 118.bryanh@giraffe-data.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message KOIZUMI Satoru 2010-05-09 03:21:37 BUG #5455: two PGTYPES_NUM_OVERFLOWs
Previous Message Bryan Henderson 2010-05-08 23:42:12 reference to undefined macro _MSC_VER