Re: [HACKERS] boolean in C

2009-07-16 Thread Dann Corbit
> -Original Message- > From: pgsql-hackers-ow...@postgresql.org [mailto:pgsql-hackers- > ow...@postgresql.org] On Behalf Of Bernd Helmle > Sent: Thursday, July 16, 2009 8:47 AM > To: Grzegorz Jaskiewicz > Cc: pgsql-hackers Hackers > Subject: Re: [HACKERS] boolean in

Re: [HACKERS] boolean in C

2009-07-16 Thread Bernd Helmle
--On 16. Juli 2009 13:32:03 +0100 Grzegorz Jaskiewicz wrote: oh, another thing. stdbool is C99 standard feature. Not gcc extension. There might be compiler versions out there which claims to be C99 but do not provide full compliant include headers. SUN Studio 12 at least has the followi

Re: [HACKERS] boolean in C

2009-07-16 Thread Tom Lane
Grzegorz Jaskiewicz writes: > On 16 Jul 2009, at 15:17, Tom Lane wrote: >> That's hardly going to improve readability for anyone. Also, it will >> flat out not work for the catalog struct declarations. When we say >> "bool relhasindex;" the compiler had better think that that's a >> one-byte fie

Re: [HACKERS] boolean in C

2009-07-16 Thread Zdenek Kotala
Grzegorz Jaskiewicz píše v čt 16. 07. 2009 v 14:59 +0100: > > > >> Why C89, and not C99 ? Virtually all compilers for last 4 years have/ > >> had C99 support. > > > > Well, I think we want to run on systems that are older than 4 years, > > too. > > > Sure, but that's probably less than 1% of

Re: [HACKERS] boolean in C

2009-07-16 Thread Grzegorz Jaskiewicz
On 16 Jul 2009, at 15:17, Tom Lane wrote: Grzegorz Jaskiewicz writes: That's hardly going to improve readability for anyone. Also, it will flat out not work for the catalog struct declarations. When we say "bool relhasindex;" the compiler had better think that that's a one-byte field. Sur

Re: [HACKERS] boolean in C

2009-07-16 Thread Tom Lane
Grzegorz Jaskiewicz writes: > On 16 Jul 2009, at 14:53, Peter Eisentraut wrote: the standard does not promise that type _Bool has size = 1 byte. We have to have that because of on-disk compatibility requirements. >>> I think the latter is easily fixable, or forceable to be one byte. >>

Re: [HACKERS] boolean in C

2009-07-16 Thread Grzegorz Jaskiewicz
On 16 Jul 2009, at 14:53, Peter Eisentraut wrote: On Thursday 16 July 2009 16:23:31 Grzegorz Jaskiewicz wrote: On 16 Jul 2009, at 14:20, Tom Lane wrote: Grzegorz Jaskiewicz writes: oh, another thing. stdbool is C99 standard feature. We are still targeting C89, not C99. Another reason not

Re: [HACKERS] boolean in C

2009-07-16 Thread Peter Eisentraut
On Thursday 16 July 2009 16:23:31 Grzegorz Jaskiewicz wrote: > On 16 Jul 2009, at 14:20, Tom Lane wrote: > > Grzegorz Jaskiewicz writes: > >> oh, another thing. > >> stdbool is C99 standard feature. > > > > We are still targeting C89, not C99. > > > > Another reason not to depend on stdbool is tha

Re: [HACKERS] boolean in C

2009-07-16 Thread Tom Lane
Grzegorz Jaskiewicz writes: > Why C89, and not C99 ? Virtually all compilers for last 4 years have/ > had C99 support. Not everybody is running a compiler released within the last 4 years. The short answer is that C99 doesn't appear to offer enough advantage over C89, *for our purposes*, to jus

Re: [HACKERS] boolean in C

2009-07-16 Thread Grzegorz Jaskiewicz
On 16 Jul 2009, at 14:20, Tom Lane wrote: Grzegorz Jaskiewicz writes: oh, another thing. stdbool is C99 standard feature. We are still targeting C89, not C99. Another reason not to depend on stdbool is that, so far as I can see, the standard does not promise that type _Bool has size = 1 by

Re: [HACKERS] boolean in C

2009-07-16 Thread Tom Lane
Grzegorz Jaskiewicz writes: > oh, another thing. > stdbool is C99 standard feature. We are still targeting C89, not C99. Another reason not to depend on stdbool is that, so far as I can see, the standard does not promise that type _Bool has size = 1 byte. We have to have that because of on-disk

Re: [HACKERS] boolean in C

2009-07-16 Thread Grzegorz Jaskiewicz
oh, another thing. stdbool is C99 standard feature. Not gcc extension. Just in case, someone thinks otherwise. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers

Re: [HACKERS] boolean in C

2009-07-16 Thread Grzegorz Jaskiewicz
On 16 Jul 2009, at 12:52, Bernd Helmle wrote: --On 16. Juli 2009 11:12:34 +0100 Grzegorz Jaskiewicz > wrote: Now, for us, we will probably change it, but is there any reason for postgresql nowadays not to use stdbool.h, apart from fact, that no one made an effort ? Having said that, woul

Re: [HACKERS] boolean in C

2009-07-16 Thread Bernd Helmle
--On 16. Juli 2009 11:12:34 +0100 Grzegorz Jaskiewicz wrote: Now, for us, we will probably change it, but is there any reason for postgresql nowadays not to use stdbool.h, apart from fact, that no one made an effort ? Having said that, wouldn't it be easy as just replacing all TRUE/FALSE/BO

[HACKERS] boolean in C

2009-07-16 Thread Grzegorz Jaskiewicz
Hi folks, Today I got bitten a bit, trying to write C function for postgresql, that also includes some of company's internal stuff. Needles to say, our stuff defines BOOL, as well as postgresql's c.h include file. Now, for us, we will probably change it, but is there any reason for postgr