[PATCH c++] Reduce -Weffc++ Rule 12 false positives

Gabriel Dos Reis gdr@integrable-solutions.net
Tue Feb 7 23:10:00 GMT 2006


Dirk Mueller <dmueller@suse.de> writes:

| On Tuesday, 7. February 2006 23:25, Gabriel Dos Reis wrote:
| 
| > but, that it not what your code implements.  It implements something
| > different if I read your patch correctly.
| >
| > +struct B
| > +{
| > +  B() {}
| > +
| > +  int bogus;         // { dg-bogus "should be initialized in the member" }
| > +  nontriv right;     // { dg-warning "should be initialized in the member"
| > } +};
| >
| > We should be warning to the effect that B::bogus is not initialized.
| 
| Ah, thats what you worry about. Ok, modify the testcase: 

just modify this particular testcase does not make my objection goes
away :-)

| 
| struct B
| {
|   B() { bogus = 42; }
| 
|   int bogus;         // { dg-bogus "should be initialized in the member" }
|   nontriv right;     // { dg-warning "should be initialized in the member"
| };

again, this read completely backward to me:  If we shall warn, then it
mus be that B::bogus is not initialized, whereas B::right is.  
In fact, I think the current behaviour is just about right.

-- Gaby



More information about the Gcc-patches mailing list