bug-gnulib
[Top][All Lists]
Advanced

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

Re: bool and C23


From: Bruno Haible
Subject: Re: bool and C23
Date: Sun, 18 Sep 2022 22:01:02 +0200

Paul Eggert wrote:
> >   #include "unitypes.h"
> >   
> > +/* Get bool.  */
> > +#include <stdbool.h>
> 
> In examples like these would it make sense to do the following instead? 
> 
>    #if !@HAVE_C_BOOL@ && !defined __cplusplus
>     #include <stdbool.h>
>    #endif

No, this would not work:
  * @HAVE_C_BOOL@ tests a property of the C compiler that has built
    libunistring. It is unrelated to the compiler that uses <unistr.h>
    after it has been installed in public locations.
  * As we have just discovered (re Sun C++), 'defined __cplusplus' is not
    a guarantee that 'true' is defined correctly. So, even in C++ mode,
    it may be a win to include <stdbool.h>. Remember, here we are in a
    context where gl_C_BOOL / AC_C_BOOL has not been invoked.

Bruno






reply via email to

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