You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[diff.expr] Undocumented change of 0 == 0 type from int to bool #9299
We document in [diff.iso] that the types of string literals and character literals are changed, but we dubiously do not document that 0 == 0 (generally, equality and relatioal comparisons) produce int in C but bool in C++.
This feels like a pretty relevant difference, although it's hard to observe in practice because integer promotion gets rid of boolness in lots of cases.
Activity
frederick-vs-ja commentedon Sep 3, 2026
Built-in
&&and||operators also produceintin C butboolin C++.jensmaurer commentedon Sep 3, 2026
Do you have an example where this is observable with C-only syntax?
eisenwave commentedon Sep 3, 2026
is almost certainly failing in C, but guaranteed to pass in C++.
And obviously, you can observe it with
_Genericandtypeof, but that's probably less interesting for a [diff] entry.jensmaurer commentedon Sep 3, 2026
_Generic and typeof are not valid C++.
frederick-vs-ja commentedon Sep 4, 2026
We can observe these with
autoand pointer variables. Although it seems quite hard to do so with pre-C23 constructs.Halalaluyafail3 commentedon Sep 4, 2026
Here is another way that it can be observed in C23 and C++26:
ckd_add does not accept bools, so it is invalid only in C++.
Halalaluyafail3 commentedon Sep 4, 2026
It may also be worth mentioning that some library functions such as isnormal have different return types in C++, changing from int to bool.