[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: bool and C23
From: |
Paul Eggert |
Subject: |
Re: bool and C23 |
Date: |
Mon, 15 Aug 2022 15:04:51 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 |
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.