g++ -Weffc++ key and libraries

C

crimaniak

Hi All!

I read about -Weffc++ key and try to use it to make my code more
reliable. But compiler gives me about 1500 warnings for project and
most of them located in used libraries: boost, dlib, json_spirit and
so on. For example every time then you use boost::noncopyable (class
foo : boost::noncopyable ....) you have warning about non-virtual
destructor in base class boost::noncopyable. Additional you have
warnings about absence of operator= and copy constructor. And so on,
so on, so on...

- Is boost need some adjusting to support Scott Meyers
recommendations?
- Is -Weffc++ mode too paranoic?

What do you think?
 
V

Victor Bazarov

Hi All!

I read about -Weffc++ key

What's that?
> and try to use it to make my code more
reliable. But compiler gives me about 1500 warnings for project and
most of them located in used libraries: boost, dlib, json_spirit and
so on. For example every time then you use boost::noncopyable (class
foo : boost::noncopyable ....) you have warning about non-virtual
destructor in base class boost::noncopyable. Additional you have
warnings about absence of operator= and copy constructor. And so on,
so on, so on...

- Is boost need some adjusting to support Scott Meyers
recommendations?

You should probably ask in Boost forums.
- Is -Weffc++ mode too paranoic?

What's "-Weffc++ mode"?
What do you think?

Not much. I've not had my coffee yet.

V
 
M

Michael Tsang

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Victor said:
What's that?


You should probably ask in Boost forums.


What's "-Weffc++ mode"?


Not much. I've not had my coffee yet.

V

- -Weffc++ is some warning about bad C++ programming practice:

- - default copy constructor or assignment operator declared in a class with
object pointer members
- - member not initialised in the member initialisation list in constructor
- - non-virtual destructor found in base classes
- - returning anything other than *this in operator=
- - returning a reference to a local object
- - overloading sequence operators

Quote from man page:
When selecting this option, be aware that the standard library
headers do not obey all of these guidelines; use grep -v to filter out those
warnings.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAksVIEYACgkQG6NzcAXitM9ZhACgg9V09Dr8upUPl640TYqSEKUp
jiIAoItttgVZDpfz3TYuWaDhR/V8fk6N
=3NBk
-----END PGP SIGNATURE-----
 
S

SeanW

- Is boost need some adjusting to support Scott Meyers
recommendations?
- Is -Weffc++ mode too paranoic?
What do you think?

It's not that it's too paranoid, just that it's a style
guide that not all projects follow. There may be no
will in various projects to compile cleanly with -Weffc++.

Your choices are to either persuade those projects to
get -Weffc++-clean (which could be a hard sell), put
up with the noise, or just not use that option.

For those that don't know, -Weffc++ is a g++ option
that warns about violations of some recommendations from
the "Effective C++" series.

Sean
 
C

crimaniak

Thanks all for answers!

Now I will try to find how to eliminate some warnings because I still
want to use this mode fro my code but don't want to find my errors
between tons of unusable warnings from libraries.
 
R

red floyd

Thanks all for answers!

Now I will try to find how to eliminate some warnings because I still
want to use this mode fro my code but don't want to find my errors
between tons of unusable warnings from libraries.

Then try gnu.g++.help, not here. This is a question about how to
use a specific toolset.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top