Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread Paul Eggert
On 08/29/2012 02:07 PM, Michael Goffioul wrote: > Thanks for that. Your welcome. While in an unrelated meeting today it popped into my head that the patch wasn't quite right, as in C++ mode it defines _Bool to _Bool (via bool), not to bool as it should. I pushed this further patch to fix that:

Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread Michael Goffioul
On Wed, Aug 29, 2012 at 6:31 PM, Paul Eggert wrote: > On 08/29/2012 10:16 AM, Michael Goffioul wrote: > \ > > My GCC stdbool.h is quite different: > > > > #ifndef __cplusplus > > > > #define bool_Bool > > #define true1 > > #define false 0 > > That's essentially what gnulib is doing as o

Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread Daniel J Sebald
On 08/29/2012 01:27 PM, John W. Eaton wrote: On 29-Aug-2012, Bastien ROUCARIES wrote: | n Wed, Aug 29, 2012 at 7:36 PM, John W. Eaton wrote: |> On 29-Aug-2012, Paul Eggert wrote: |> |> | On 08/29/2012 10:00 AM, John W. Eaton wrote: |> |> Why define true, false, and bool to anything when usi

Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread John W. Eaton
On 29-Aug-2012, Bastien ROUCARIES wrote: | n Wed, Aug 29, 2012 at 7:36 PM, John W. Eaton wrote: | > On 29-Aug-2012, Paul Eggert wrote: | > | > | On 08/29/2012 10:00 AM, John W. Eaton wrote: | > | > Why define true, false, and bool to anything when using C++? | > | | > | Maybe it's for '#ifdef boo

Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread Bastien ROUCARIES
n Wed, Aug 29, 2012 at 7:36 PM, John W. Eaton wrote: > On 29-Aug-2012, Paul Eggert wrote: > > | On 08/29/2012 10:00 AM, John W. Eaton wrote: > | > Why define true, false, and bool to anything when using C++? > | > | Maybe it's for '#ifdef bool' but to be honest I'm just doing what > | GCC does. P

Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread John W. Eaton
On 29-Aug-2012, Paul Eggert wrote: | On 08/29/2012 10:00 AM, John W. Eaton wrote: | > Why define true, false, and bool to anything when using C++? | | Maybe it's for '#ifdef bool' but to be honest I'm just doing what | GCC does. Perhaps you can ask the GCC developers why they do did | it that wa

Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread Paul Eggert
On 08/29/2012 10:16 AM, Michael Goffioul wrote: \ > My GCC stdbool.h is quite different: > > #ifndef __cplusplus > > #define bool_Bool > #define true1 > #define false 0 That's essentially what gnulib is doing as of today. It does it with one more level of indirection, but the same beha

Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread Michael Goffioul
On Wed, Aug 29, 2012 at 6:13 PM, Paul Eggert wrote: > On 08/29/2012 10:00 AM, John W. Eaton wrote: > > Why define true, false, and bool to anything when using C++? > > Maybe it's for '#ifdef bool' but to be honest I'm just doing what > GCC does. Perhaps you can ask the GCC developers why they do

Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread Paul Eggert
On 08/29/2012 10:00 AM, John W. Eaton wrote: > Why define true, false, and bool to anything when using C++? Maybe it's for '#ifdef bool' but to be honest I'm just doing what GCC does. Perhaps you can ask the GCC developers why they do did it that way Anyway, I'd be surprised if Octave cares

Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread John W. Eaton
On 29-Aug-2012, John W. Eaton wrote: | Michael, how is stdbool.h being included in Octave C++ sources? Maybe | that's a mistake that should be fixed. Oh, I see it ends up being included in data.cc because we include base64.h from gnulib there. jwe

Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread John W. Eaton
On 29-Aug-2012, Michael Goffioul wrote: | On Wed, Aug 29, 2012 at 4:44 PM, Michael Goffioul | wrote: | | Thanks, that should indeed redefining true and false... | | | I meant: that should indeed avoid redefining true and false... Why define true, false, and bool to anything when using C++

Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread Paul Eggert
On 08/29/2012 08:44 AM, Michael Goffioul wrote: > AFAIK "bool" is a standard C++ type, there's no need to redefine it. The idea was that gnulib should produce a GNU-like environment in other platforms, and on GNU platforms this: #include #ifdef bool return "bool is defined"; #endif returns "b

Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread Michael Goffioul
On Wed, Aug 29, 2012 at 4:44 PM, Michael Goffioul < michael.goffi...@gmail.com> wrote: > Thanks, that should indeed redefining true and false... > I meant: that should indeed avoid redefining true and false... Michael.

Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread Michael Goffioul
On Wed, Aug 29, 2012 at 3:59 PM, Paul Eggert wrote: > I'm no C++ expert but this one looks like there's a straightforward > fix: just use C++'s bool if available. That's what GCC's stdbool.h does, > anyway. With other compilers this may be an issue of C and C++ > disagree with how _Bool is impl

Re: Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread Paul Eggert
I'm no C++ expert but this one looks like there's a straightforward fix: just use C++'s bool if available. That's what GCC's stdbool.h does, anyway. With other compilers this may be an issue of C and C++ disagree with how _Bool is implemented but I suppose we can burn those bridges when we come t

Problem with stdbool.h redefining true/false even in C++

2012-08-29 Thread Michael Goffioul
Hi, When compiling octave with MSVC under Windows, I found an issue with how stdbool.h (from gnulib) redefines true/false unconditionally, even in C++ mode. The net result is that in C++, true/false do not have the bool type anymore, but integer. This creates miscompilation in octave code, where t