[Development] override keyword on destructors

Sérgio Martins sergio.martins at kdab.com
Mon Aug 20 14:08:36 CEST 2018


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.

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.



[1] - 
https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rh-override

Regards,
-- 
Sérgio Martins | sergio.martins at kdab.com | Senior Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel: Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - The Qt, C++ and OpenGL Experts



More information about the Development mailing list