Boost logo

Boost :

Subject: Re: [boost] Official warnings policy?
From: Stewart, Robert (Robert.Stewart_at_[hidden])
Date: 2009-11-06 08:37:59


Emil Dotchevski wrote:
> On Thu, Nov 5, 2009 at 3:46 PM, Kim Barrett
> <kab.conundrums_at_[hidden]> wrote:
> > On Nov 5, 2009, at 5:32 PM, Emil Dotchevski wrote:
> >> On Thu, Nov 5, 2009 at 1:50 PM, Kim Barrett
> <kab.conundrums_at_[hidden]>
> >> wrote:
> >>> On Nov 5, 2009, at 2:04 PM, Emil Dotchevski wrote:
>
> >>>> - non-virtual-dtor on GCC contradicts a valid design choice.
>
> >>> At least in recent versions of gcc, this warning is not
> >>> generated when there is a non-public dtor.
>
> >> This doesn't help much. [...] but it will complain in the derived
> >> class, which typically doesn't even define a destructor explicitly.
>
> > On the other hand, once one
> > has paid the cost of making a class polymorphic anyway, is
> > there really much
> > (if any?) benefit to making its destructor non-virtual?

Exactly.

> Q: Who would want to know that boost::exception_ptr's
> destructor is not virtual?
>
> A: Only someone who wants to build a polymorphic type hierarchy with
> boost::exception_ptr as a base, calling delete through a
> boost::exception_ptr base pointer.
>
> So, exception_ptr's destructor should be virtual to keep *that* guy
> out of trouble?

Making the dtor virtual does no harm and avoids questions and concerns from any of your customers. The decision seems easy.

_____
Rob Stewart robert.stewart_at_[hidden]
Software Engineer, Core Software using std::disclaimer;
Susquehanna International Group, LLP http://www.sig.com

IMPORTANT: The information contained in this email and/or its attachments is confidential. If you are not the intended recipient, please notify the sender immediately by reply and immediately delete this message and all its attachments. Any review, use, reproduction, disclosure or dissemination of this message or any attachment by an unintended recipient is strictly prohibited. Neither this message nor any attachment is intended as or should be construed as an offer, solicitation or recommendation to buy or sell any security or other financial instrument. Neither the sender, his or her employer nor any of their respective affiliates makes any warranties as to the completeness or accuracy of any of the information contained herein or that this message or any of its attachments is free of viruses.


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