4 ms·
I gave up from C99 and its successors when I saw that they introduced _Bool. Actually, I've never understood the meaning behind having a boolean type in any la
by zvrba 15y ago
I gave up from C99 and its successors when I saw that they introduced _Bool. Actually, I've never understood the meaning behind having a boolean type in any language. [It would kinda make sense if conditionals accepted ONLY boolean arguments, and then having bool type would make sense only as a return value of a function. Why somebody feels a need to declare a boolean variable is beyond me.]
- dextorious 15y agoSo your intentions with the bool using code/signatures are clearer. Isn't it OBVIOUS?
- zvrba 15y agoNo, it's not. Adding a new built-in type that doesn't participate in type-checking in any meaningful way just clutters the language. _Bool is like int, just having unspecified size and slower, since the compiler has to ensure that it shall contain etiher 0 or 1. Very little, if anything, would have been lost by standardizing "typedef unsigned bool;"
- dextorious 15y ago"""No, it's not. Adding a new built-in type that doesn't participate in type-checking in any meaningful way just clutters the language.""" 1) It's not about type-checking, it's about reading code. 2) It's not like type-checking is C's strong point.
- kzrdude 15y agoThere are so many different ways to communicate errors through an int in C. For example 0=success and negative error codes. With _Bool, at least one scheme is obvious from the signature.