Re: bool: symbol name collision

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: bool: symbol name collision
Дата
Msg-id 1273495153.11359.24.camel@fsopti579.F-Secure.com
обсуждение исходный текст
Ответ на Re: bool: symbol name collision  (bryanh@giraffe-data.com (Bryan Henderson))
Ответы Re: bool: symbol name collision  (bryanh@giraffe-data.com (Bryan Henderson))
Список pgsql-bugs
On sön, 2010-05-09 at 17:37 +0000, Bryan Henderson wrote:
> >it would be
> >better if Bryan could show us a concrete example that is causing
> >problems.
>
> I don't know how concrete you want.

Something one can download and compile.

> A user defined function server extension
> #includes a header file that #includes another that #includes the C99
> standard header file <stdbool.h>.  The server extension also #includes
> <postgres.h>.  The compile fails with the multiple definition of type
> "bool".

Well, let's say including stdbool.h is not supported then. ;-)

> Here's a worse one (but hypothetical; I haven't actually done this):
> the server extension is compiled with a C++ compiler that uses 4 bytes
> for "bool".  Everything compiles, but the PG_GETARG_INT32() call gets
> the wrong argument because the server thinks bool is one byte while
> the server extension thinks it is 4.

You should use PG_GETARG_BOOL().  I don't see why this necessarily
couldn't work.

We did actually include a sizable patch into 9.0 to remove conflicts
with C++ reserved words (typename and such).  I don't recall any
complaints about bool at the time.  There is a test script for this in
src/tools/pginclude/cpluspluscheck.

В списке pgsql-bugs по дате отправления:

Предыдущее
От: Takahiro Itagaki
Дата:
Сообщение: Re: "SET search_path" clause ignored during function creation
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: bool: symbol name collision