STL and -Weffc++ (was: Bug in optimizer...)

Gerald Pfeifer pfeifer@dbai.tuwien.ac.at
Thu Jan 29 07:13:00 GMT 1998


On Wed, 28 Jan 1998, Matt Austern wrote:
> I suppose my question would be whether the warnings are reasonable
> (i.e. they're pointing out potential errors) or whether they simply
> represent someone's not-univerally-shared stylistic opinion.

I believe that at least the following warning

  /include/g++/stl_function.h:400: warning:  `subtractive_rng::index1'
  should be initialized in the member initialization list

is quite reasonable.

While using member initialization lists does not seem to make a 
difference for "int", it does so for classes: In one case constructor
and assignment operator are invoked, in the other just the constructor
of the class member. 


So in general it might be advisible to always use member initialization
lists where this is feasible: First to be consistent and second in case
the type of class members ever changes. 

What do you think about this? Any chance that this gets changed in 
the SGI sources?

Gerald
-- 
Gerald Pfeifer (Jerry)      Vienna University of Technology
pfeifer@dbai.tuwien.ac.at   http://www.dbai.tuwien.ac.at/~pfeifer/




More information about the Gcc-bugs mailing list