> In Foo the variable is just uninitialized, in Bar it is definetly used
> uninitialized and in Baz it might be used uninitialized. Is there any
> -W switch to make g++ detect such errors or is that a shortcomming of
> -Wuninitialized?

No, there isn't any such switch. It may be a shortcomming of
-Wuninitialized in the sense that Wuninitialized cannot possibly
detect all uninitialized cases correctly. There is, in addition, a
trade-off between the complexity of the Wuninitialized code and the
cases that it can detect. GCC is not a static code analyser.
-Wuninitialized purpose is to report cases that can be easily analysed
by GCC.

This case cannot be easily detected with the current Wuninitialized
framework. Whether it could be detected without too much added
complexity, I don't know but I would guess it cannot.

In summary, feel free to report this as a feature request [*] and
perhaps someone will step up and devise a way to do this. However, do
not expect a solution in the near-future (or a solution at all).

Cheers,

Manuel López-Ibáñez.

[*] http://gcc.gnu.org/bugs.html

Reply via email to