Suboptimal warning formatting with `bool` type in C
peter0x44
peter0x44@disroot.org
Wed Nov 1 23:28:14 GMT 2023
On 2023-11-01 23:13, Joseph Myers wrote:
> On Wed, 1 Nov 2023, peter0x44 via Gcc wrote:
>
>> Why is #define used instead of typedef? I can't imagine how this could
>> possibly break any existing code.
>
> That's how stdbool.h is specified up to C17. In C23, bool is a keyword
> instead.
I see, I didn't know it was specified that way. It seems quite strange
that typedef wouldn't be used for this purpose.
I suppose perhaps it matters if you #undef bool and then use it to
define your own type? Still, it seems very strange to do this.
Maybe it's something to offer as a GNU extension? Though, I'm leaning
towards too trivial to be worth it, just for a (very minor) improvement
to a diagnostic that can probably be handled in other ways.
More information about the Gcc
mailing list