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. -- Summary: Request warning for casts to _Bool Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: hpa at zytor dot com GCC build triplet: all GCC host triplet: all GCC target triplet: all http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34455