This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: No pointer conversion warning for "bool" in C/C++


Jon Grant <jg@jguk.org> writes:

> Currently gcc, and g++ don't give a warning when a pointer was
> converted to a bool, in the same way it is for other types.

There is a lot of code which uses
    if (p)
where p is a pointer to test whether p is not NULL.  I don't think we
could reasonably have gcc warn about such a case.

We might be able to separate out conversion to bool on assignment from
conversion to bool in a test, though.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]