On 4/5/2012 4:24 PM, Russ Allbery wrote:
Gabriel Dos Reis<g...@integrable-solutions.net>  writes:

If it is the non-expert that would be caught in code so non-obvious that
-Wuninitialized would trip into false positives, then it is highly
likely that the code might in fact contain an error.

I wish this were the case, but alas I continue to see fairly trivial false
positives from -Wuninitialized.  Usually cases where the initialization
and the use are both protected by equivalent conditionals at different
places in the function.

Yes, and often it is not so easy for the compiler to see that the
conditionals are always the same

Personally, as a matter of *style*, I eliminate such cases either by
initializing the variable or restructuring the function.  But this is very
much a question of style, not of correctness.

Indeed, and for me, when you are forced to do an initialization like
this, it is mandatory to comment why you are initializing it, otherwise
it obscures the code ("why is this being initialized, where is that
value used?") and that ends up junky IMO. The Ada front end unfortunately has quite a few such commented junk initializations.


Reply via email to