Boost logo

Boost :

Subject: Re: [boost] [exception] warning about non-virtual destructor - resolution?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2012-04-16 23:24:25


On Monday 16 April 2012 15:32:06 Emil Dotchevski wrote:
> On Mon, Apr 16, 2012 at 1:51 PM, Andrey Semashev
> <andrey.semashev_at_[hidden]>wrote:
> >
> > IMHO, you are taking it too seriously. If you want to disable the call to
> > the
> > destructor, you typically declare it private or protected. Whether it is
> > virtual or not is another story and irrelevant to the access restriction
> > (which is actually what you're trying to impose).
>
> The meaning of virtual is "this function is designed to be called through a
> base type pointer". This is simply not true for this code, it would be
> misleading and incorrect to use virtual in this case.

It doesn't matter if you can't call it anyway since it's protected.

> > And declaring it virtual
> > doesn't make the code uglier. In fact, compared to all the machinery
> > required
> > to disable the warning for every compiler, it is a cleaner solution.
>
> The "machinery" is needed anyway to disable all other warnings, and it is
> much cleaner than dealing with each individual warning emitted by the many
> compilers Boost is used with.
>
> Besides, if a warning (any warning) escapes the "machinery", this is a bug
> that I want to fix. In this particular case, people say they get the
> warning but nobody has given me exact code that produces it.

The current machinery is applied header-wise and doesn't really clutter the
code. I supposed this particular warning would be disabled for a particular
class or expression (because disabling it globally is excessive).


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk