Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   C++ (http://www.velocityreviews.com/forums/f39-c.html)
-   -   g++ -Weffc++ key and libraries (http://www.velocityreviews.com/forums/t707247-g-weffc-key-and-libraries.html)

crimaniak@googlemail.com 12-01-2009 11:12 AM

g++ -Weffc++ key and libraries
 
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?

Victor Bazarov 12-01-2009 12:59 PM

Re: g++ -Weffc++ key and libraries
 
crimaniak@googlemail.com wrote:
> 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
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask

Michael Tsang 12-01-2009 01:55 PM

Re: g++ -Weffc++ key and libraries
 
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Victor Bazarov wrote:

> crimaniak@googlemail.com wrote:
>> 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


- -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)

iEYEARECAAYFAksVIEYACgkQG6NzcAXitM9ZhACgg9V09Dr8up UPl640TYqSEKUp
jiIAoItttgVZDpfz3TYuWaDhR/V8fk6N
=3NBk
-----END PGP SIGNATURE-----


SeanW 12-01-2009 02:29 PM

Re: g++ -Weffc++ key and libraries
 
On Dec 1, 6:12*am, "criman...@googlemail.com"
<criman...@googlemail.com> wrote:
> - 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

crimaniak@googlemail.com 12-02-2009 10:45 PM

Re: g++ -Weffc++ key and libraries
 
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.

red floyd 12-03-2009 12:15 AM

Re: g++ -Weffc++ key and libraries
 
On Dec 2, 2:45*pm, "criman...@googlemail.com"
<criman...@googlemail.com> wrote:
> 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.


All times are GMT. The time now is 11:21 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57