I think it has to keep it for externally visible functions, right?
Re:Truthiness in C
by marcosdumay on Friday September 15, 2023 @01:38PM
(#37526562)
Yes, you are right. If you have to put a bool on the stack, it will have to keep the instructions.
Did you mean `typedef int bool`?
No, _Bool is a distinct type, introduced by the 1999 edition of the standard.
No, marcosdumay wrote 'typedef bool int', by which he/she probably meant 'typedef int bool', which was not so uncommon when there was no native bool type in C, since the former would be illegal since the standard forbids typedefing already existent types such as int. strkitten informed about the probable typo.
Sorry, I managed to miss the context.
C has had _Bool natively since the 1999 ISO standard (24 years ago). The standard header <stdbool.h> has "#define bool _Bool". (The ugly name "_Bool" was chosen to avoid conflicting with existing code.)
The upcoming C23 standard will define "bool" as a keyword.
Re:Truthiness in C
by kevin_thibedeau on Friday September 15, 2023 @04:50PM
(#37528957)
More significantly, true and false are now keywords.
I'm quite confident the compiler will optimize that test-and-move away as soon as you use the bool for something, giving you the same assembly as a last century's `typedef bool int`.