I recently finished converting a large codebase from using "int" to using "bool" (i.e. _Bool) for booleans. This is a big win for debuggability. However, unfortunately the code has to be portable to inferior compilers which don't have _Bool implemented yet; for those we use: typedef enum { false, true } bool; As such, it would be a very nice thing to have an optional warning for any conversions of non-boolean objects (those not known to contain only 0 or 1) to _Bool using either an implicit conversion or a cast. The "safe" way to do it in a backwards-compatible way is using the !! pseudo-operator.
Created attachment 14746 [details] Proposed test cases
Any interest in this at all? This is a major missing feature for me at the moment.
To be honest, I am not sure whether this is really useful or not for other people. And I am not sure whether it is actually possible. What I am sure is that there is nobody except you interested in implementing it, so if you want to get it done, you will have to work on it (or pay someone to do it). Meanwhile, I am putting this in WAITING, so it doesn't show up as pending confirmation.
(In reply to Manuel López-Ibáñez from comment #3) > To be honest, I am not sure whether this is really useful or not for other > people. And I am not sure whether it is actually possible. > > What I am sure is that there is nobody except you interested in implementing > it, so if you want to get it done, you will have to work on it (or pay > someone to do it). > > Meanwhile, I am putting this in WAITING, so it doesn't show up as pending > confirmation. Changing to SUSPENDED so people don't close it from being in WAITING for so long
10 years have passed since the original request. These days compilers that don't have any support for bool at all can be genuinely considered rare at the very best. I don't think it is applicable anymore.
Thanks, closing out then.