public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/34455]  New: Request warning for casts to _Bool
@ 2007-12-13 19:50 hpa at zytor dot com
  2007-12-13 19:56 ` [Bug c/34455] " hpa at zytor dot com
  2009-02-26 22:56 ` hpa at zytor dot com
  0 siblings, 2 replies; 4+ messages in thread
From: hpa at zytor dot com @ 2007-12-13 19:50 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/34455] Request warning for casts to _Bool
  2007-12-13 19:50 [Bug c/34455] New: Request warning for casts to _Bool hpa at zytor dot com
@ 2007-12-13 19:56 ` hpa at zytor dot com
  2009-02-26 22:56 ` hpa at zytor dot com
  1 sibling, 0 replies; 4+ messages in thread
From: hpa at zytor dot com @ 2007-12-13 19:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from hpa at zytor dot com  2007-12-13 19:56 -------
Created an attachment (id=14746)
 --> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=14746&action=view)
Proposed test cases


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34455


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/34455] Request warning for casts to _Bool
  2007-12-13 19:50 [Bug c/34455] New: Request warning for casts to _Bool hpa at zytor dot com
  2007-12-13 19:56 ` [Bug c/34455] " hpa at zytor dot com
@ 2009-02-26 22:56 ` hpa at zytor dot com
  1 sibling, 0 replies; 4+ messages in thread
From: hpa at zytor dot com @ 2009-02-26 22:56 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from hpa at zytor dot com  2009-02-26 22:56 -------
Any interest in this at all?  This is a major missing feature for me at the
moment.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34455


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug c/34455] Request warning for casts to _Bool
       [not found] <bug-34455-4@http.gcc.gnu.org/bugzilla/>
@ 2012-04-18 16:45 ` manu at gcc dot gnu.org
  0 siblings, 0 replies; 4+ messages in thread
From: manu at gcc dot gnu.org @ 2012-04-18 16:45 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34455

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING
   Last reconfirmed|                            |2012-04-18
                 CC|                            |manu at gcc dot gnu.org
     Ever Confirmed|0                           |1

--- Comment #3 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2012-04-18 16:42:46 UTC ---
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.


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-04-18 16:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-13 19:50 [Bug c/34455] New: Request warning for casts to _Bool hpa at zytor dot com
2007-12-13 19:56 ` [Bug c/34455] " hpa at zytor dot com
2009-02-26 22:56 ` hpa at zytor dot com
     [not found] <bug-34455-4@http.gcc.gnu.org/bugzilla/>
2012-04-18 16:45 ` manu at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).