autoconf
[Top][All Lists]
Advanced

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

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


From: Mojca Miklavec
Subject: Re: AC_HEADER_STDBOOL: checking for _Bool separately for C and C++
Date: Tue, 28 Aug 2012 20:47:07 +0200

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]