------- Comment #11 from jwakely dot gcc at gmail dot com  2010-06-03 09:18 
-------
(In reply to comment #10)
> (In reply to comment #9)
> > I've been experimenting with this patch, which warns if there is a missing
> > mem-initializer for a scalar.
> > 
> > It gives a false positive for cases were the member is assigned to in the
> > constructor body, or otherwise initialized before use, but it's a start, and
> > has already helped me find some missing mem-initializers in real code.
> 
> Nice but I am afraid there may be too many false positives.

Yes, I'm not proposing it in that state. It's just an experiment but has been
useful for me already.

> And what is
> different between this and the -Weffc++ warning given just below it?

-Weffc++ also enables dozens of other warnings, most of which I don't find
useful.  It is about good style, not dangerous code, and I don't like the
compiler to enforce style.

In this specific case, the Weffc++ warning complains if *any* member has no
mem-initializer. I only care about POD members which will be uninitialized, I
don't want to add a mem-initializer for e.g. a std::string member which has a
default constructor.

> > +    case OPT_Wmeminit:
> > +      warn_meminit = value;
> > +      break;
> > +
> 
> You do not need this. This is handled automatically when you defined Var in 
> the
> opt files.

Ah OK, thanks!


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=2972

Reply via email to