Re: AC_HEADER_STDBOOL: checking for _Bool separately for C and C++

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Aug 28, 2012 at 8:34 PM, Paul Eggert wrote:
> On 08/28/2012 10:58 AM, Mojca Miklavec wrote:
>> #if HAVE_STDBOOL_H
>> # include <stdbool.h>
>> #else
>> # ifndef __cplusplus
>> #  if ! HAVE__BOOL
>>     typedef unsigned char _Bool;
>> #  endif
>> #  define bool _Bool
>> #  define false 0
>> #  define true 1
>> # endif
>> // not really needed except to "conform with C99"
>> # define __bool_true_false_are_defined 1
>> #endif
>
> This doesn't look right, as it means that older
> C++ environments won't have _Bool as they should.

C++ (at least here) doesn't have _Bool defined until stdbool.h is
included. But if that's the intention - would an extra
   #define _Bool bool
suffice?

That's for example:

#if HAVE_STDBOOL_H
# include <stdbool.h>
#else
# ifdef __cplusplus
   // maybe even #if !defined(_Bool)?
#  define _Bool bool
# else
#  if ! HAVE__BOOL
    typedef unsigned char _Bool;
#  endif
#  define bool _Bool
#  define false 0
#  define true 1
# endif
# define __bool_true_false_are_defined 1
#endif

> I think we need to fix the real problem, somehow,
> though I don't use C++ myself and am not the best
> person to advise.

What exactly is "the real problem" here?

Thank you,
    Mojca

_______________________________________________
Autoconf mailing list
Autoconf@xxxxxxx
https://lists.gnu.org/mailman/listinfo/autoconf


[Index of Archives]     [GCC Help]     [Kernel Discussion]     [RPM Discussion]     [Red Hat Development]     [Yosemite News]     [Linux USB]     [Samba]

  Powered by Linux