Re: bool: symbol name collision

Поиск
Список
Период
Сортировка
От Peter Eisentraut
Тема Re: bool: symbol name collision
Дата
Msg-id 1273423739.16789.2.camel@vanquo.pezone.net
обсуждение исходный текст
Ответ на Re: bool: symbol name collision  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: bool: symbol name collision  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: bool: symbol name collision  (bryanh@giraffe-data.com (Bryan Henderson))
Список pgsql-bugs
On sön, 2010-05-09 at 11:35 -0400, Tom Lane wrote:
> bryanh@giraffe-data.com (Bryan Henderson) writes:
> > 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.
>
> Sorry, this isn't going to happen.  It would break far too much existing
> code, and we consider building server extensions with C++ to be
> unsupported anyway.

Um, our code has

#ifndef __cplusplus

#ifndef bool
typedef char bool;
#endif

#ifndef true
#define true    ((bool) 1)
#endif

etc.

so somehow it was once thought that it is worth supporting other
definitions of bool.  Now to make this work in practice you probably
need to play some games with undefining and redefining and include file
order and so on, but I think it could work.  In any case, it would be
better if Bryan could show us a concrete example that is causing
problems.

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: BUG #5455: two PGTYPES_NUM_OVERFLOWs
Следующее
От: Tom Lane
Дата:
Сообщение: Re: bool: symbol name collision