Re: bool and C23

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

 



On 8/15/22 14:39, Bruno Haible wrote:

to exclude other problems, we need to check it on a platform-by-platform
basis.

In the long run this problem will vanish, as in the long run config.h will do nothing (that's all that's needed for C23 and C++).

In the shorter run I think we'll be OK for C17 and earlier if we include <stdbool.h> on platforms where bool+true+false don't work out of the box, because (unlike some other .h files) stdbool.h doesn't tend to cause conflicts.

If I'm wrong, I expect we'll be able to fix things on a platform-by-platform basis. In the worst case I suppose we could put something like this into config.h:

  #ifndef HAVE_BUILTIN_BOOL_TRUE_FALSE
  # ifndef HAVE__BOOL
  #  define _Bool signed char
  # endif
  # define bool _Bool
  # define true 1
  # define false 0
  #endif

This doesn't #include any files, and conforms to C99 thru C17 even if you #include <stdbool.h> later. However, I hope we needn't go to this extreme as I expect it would cause some false alarms about multiply-defined macros.




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

  Powered by Linux