David Binderman wrote:

> [lib/sig2str.c:329]: (warning) Logical conjunction always evaluates to false: 
> signum <= -1 && signum>= 0.

This seems to be cppcheck complaining about a test that is needed
on other platforms, but which the compiler can optimize away on
your platform.  We can safely ignore this diagnostic as well:
it's perfectly OK, and in fact nice, to have code that a compiler
can optimize away on some platforms.

>   if (!print_database < argc)
> 
> Some round brackets might help clarify the code
> 
>   if ((!print_database) < argc)

The code's pretty clear as-is, since there
are spaces around the " < " but not after the "!".

I think I'd rather ignore this diagnostic; in general,
"Comparison of a boolean value using relational operator (<,>, <= or>=)"
is bogus.  There's nothing wrong with comparing Booleans.
If you have two Booleans A and B, and want to write "A implies B",
it's often faster and (once you get used to it) more comprehensible
to write "A <= B", instead of the "!A | B" that cppcheck would
seem to require.  (Admittedly I'd rather write "A -> B"
but this is C we're talking about....)

Eric already covered the other two diagnostics you mentioned.



Reply via email to