[Development] override keyword on destructors
André Pönitz
apoenitz at t-online.de
Mon Aug 20 08:47:34 CEST 2018
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'
More information about the Development
mailing list