n Wed, Aug 29, 2012 at 7:36 PM, John W. Eaton <j...@gnu.org> 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. Perhaps you can ask the GCC developers why they do did > | it that way.... > | > | Anyway, I'd be surprised if Octave cares whether true, false, and bool > | are macros. If it does, then it's broken on GNUish hosts anyway, > | right? And if it doesn't, the gnulib patch should work as-is. > > No, I don't think Octave currently has any checks like this. > > For C++ code, I think '#ifdef bool' will be false. So > '#define bool bool' switches the meaning. Should that happen if > stdbool.h has been included? I don't know.
echo -e "#include <stdbool.h> \n #ifdef bool \n echo \n#endif" | g++ -E - # 1 "<stdin>" # 1 "<built-in>" # 1 "<command-line>" # 1 "<stdin>" # 1 "/usr/lib/gcc/x86_64-linux-gnu/4.6/include/stdbool.h" 1 3 4 # 2 "<stdin>" 2 echo > > This problem was a surprise to me because we don't include > stdbool.h directly in Octave C++ sources. > > jwe >