From: | Leandro Fanzone <leandro(at)hasar(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | pgsql-hackers(at)postgreSQL(dot)org |
Subject: | Re: C++ and bool constants (was Re: [NOVICE] gcc 3.0.1) |
Date: | 2001-08-27 12:49:23 |
Message-ID: | 3B8A41D3.A6BE80A8@hasar.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-novice |
Fine for me also.
Leandro.
Tom Lane wrote:
> Leandro Fanzone <leandro(at)hasar(dot)com> writes:
> > I have compiled PostgreSQL 7.1.2 with gcc 3.0.1, and have the following
> > problem: if I include first libpq++.h before iostream, id est:
> > #include <libpq++.h>
> > #include <iostream>
> > the compiler complains:
>
> > This is because somewhere in PostgreSQL you have the following code:
>
> > #ifndef true
> > #define true ((bool)1)
> > #endif
>
> Yeah. c.h has
>
> #ifndef __cplusplus
> #ifndef bool
> typedef char bool;
> #endif /* ndef bool */
> #endif /* not C++ */
>
> #ifndef true
> #define true ((bool) 1)
> #endif
>
> #ifndef false
> #define false ((bool) 0)
> #endif
>
> It's been like that for quite some time, but it's always struck me as
> bizarre: if we're willing to trust a C++ compiler to provide type
> bool, why would we not trust it to provide the literals true and false
> as well? ISTM the code should read
>
> #ifndef __cplusplus
>
> #ifndef bool
> typedef char bool;
> #endif
>
> #ifndef true
> #define true ((bool) 1)
> #endif
>
> #ifndef false
> #define false ((bool) 0)
> #endif
>
> #endif /* not C++ */
>
> Does anyone have an objection to this?
>
> regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Zeugswetter Andreas SB SD | 2001-08-27 15:25:43 | RE: extern + static issue in datetime.c |
Previous Message | Oleg Bartunov | 2001-08-27 11:24:04 | GiST vacation |
From | Date | Subject | |
---|---|---|---|
Next Message | Marc G. Fournier | 2001-08-29 15:00:38 | List archives moved and cleaned up ... |
Previous Message | Bruce Momjian | 2001-08-26 16:49:22 | Re: C++ and bool constants (was Re: [NOVICE] gcc 3.0.1) |