[Development] override keyword on destructors

Lars Knoll lars.knoll at qt.io
Tue Aug 21 16:07:14 CEST 2018


I’d agree with most comments. I find the override keyword on destructors useful, and would like to keep it/encourage having it.

Cheers,
Lars

> On 20 Aug 2018, at 08:47, André Pönitz <apoenitz at t-online.de> wrote:
> 
> On Mon, Aug 20, 2018 at 01:08:36PM +0100, Sérgio Martins via Development wrote:
>> Hi,
>> 
>> Looks like some 'override' keywords crept into a few destructors. This is
>> probably because clang-tidy warns about it (and now QtCreator).
>> 
>> IMO we should avoid it, as it's misleading. Dtors are a special case and
>> have completely different semantics. They don't replace their base class
>> dtors. They're chained instead.
> 
> That's one way look at it. 
> 
> One can also argue that it's "something" for which some base implementation
> exists and that might need double-checking when the base disappears.
> 
> It's also a hint when reading code that the base destructor's "virtual"
> actually has not been forgotten.
> 
>> This is not 100% consensual, some people like to use it.
>> 
>> But it's discouraged by the Cpp Core Guidelines [1] ; gcc's
>> -Wsuggest-override doesn't suggest it for dtors and neither does clang's
>> -Winconsistent-missing-override.
> 
>> So clang-tidy is the one odd out.
>> 
>> I'll update the coding conventions if nobody opposes.
> 
> Please not.
> 
> Andre'
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development



More information about the Development mailing list