|
|
I've seen warnings in static code analyzers that really surprised me. They can check many, many cases, some of which are maybe "impossible" to be true (for human thinking) but the code analyzers still find a case ...
Manolo is correct about evaluation of logical && and || in expressions in C and C++. A usual case is if (win && win->x() < 0); . This construct is only useful if the evaluation is guaranteed to be terminated if win == NULL (and it is).
However, in that particular case (see @erco77's screenshot) I believe the point is that the compiler doesn't "know" that Fl::screen_xyhw() always returns a value in sx, sy, sw, and sh (if this is not the case for instance if the screen number is out or range then this IS a fault). I've seen this in similar constructs with values returned by reference arguments. In this case the first sx *= s; statement would access an uninitialized variable if win != NULL .
It's probably wise to initialize these variables with 0 (zero) even if it's not really necessary (defensive programming).
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
[ Direct Link to Message ] | |
|
| |