[mythtv] [mythtv-commits] Ticket #1992: Warning fixes

Mickaël Remars mythtv at remars.com
Tue Jun 27 21:17:27 UTC 2006


Martin Ebourne wrote:
> On Mon, 26 Jun 2006 17:59:46 -0400, Daniel Kristjansson wrote:
>   
>> The classes should never be deleted via pointers to these interfaces;
>> doing so would be wrong on so many levels that it isn't even funny.
>>     
>
> Unfortunately not adding the virtual keyword won't help in this
> circumstance.
>
> I suggest you make the destructors protected instead, then if this ever
> did occur the compiler will error.
>
> On the warning front, it would be a shame to disable the warning. I've
> seen it catch several bugs so it can be valuable. Unfortunately g++ still
> warns even if the destructor is protected. Therefore I would also vote for
> adding the virtual keyword to silence the warning. Why? The warning only
> occurs if you already have one virtual function so to add another one has
> no per object cost either in code or memory footprint. Making the
> destructor protected not only documents but also enforces the usage you
> are after, so no chance of confusion arising.
>
> I'll make a patch if you like, though I'm off out to work rsn so I can
> only look at it later.
>
> Cheers,
>
> Martin.
>   
IMHO, Martin's proposal is the best solution.
Daniel, the patch is ready to be submitted if you're ok for it.

-- Mickaël


More information about the mythtv-dev mailing list