Boost logo

Boost Users :

Subject: Re: [Boost-users] How to use noncopyable?
From: Esben Mose Hansen (boost_at_[hidden])
Date: 2009-02-23 08:26:33


On Sunday 22 February 2009 08:34:23 Kim Barrett wrote:
> The warning is due to the use of -Weffc++:
>
>    Warn about violations of the following style guidelines from Scott
> Meyers' Effective C++ book:
>
>      ...
>      * Item 14: Make destructors virtual in base classes.
>      ...
>
> This is a case where that admonition is wrong. (It is a style guideline
> after all, and not necessarily prescriptive.) You might be able to suppress
> this warning by using -Wno-nonvirtual-dtors, but that may suppress warnings
> that you would actually like to see. This is one of the reasons why we're
> not using -Weffc++ where I work. (I think I recall there being some boost
> libraries that run afoul of item 7 "Never overload &&, ||, or ,." too.)

Isn't that admonishing simple wrong in all cases where the the base class is
private (and maybe protected, I've never used that)? I mean, when exactly
would you risk deleting a class through a pointer or reference to a private
base class?

I'd say that this is a gcc bug :) But I don't claim to be the ultimate C++
expert.

-- 
kind regards, Esben

Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net