[vlc-devel] [PATCH 0/2][RFC] qt4: Use Q_DECL_OVERRIDE on overridden functions

Tristan Matthews le.businessman at gmail.com
Tue Aug 12 17:13:27 CEST 2014


On Tue, Aug 12, 2014 at 10:53 AM, Uwe L. Korn <uwelk at xhochy.com> wrote:
> Using virtual repeated on functions in subclasses of the original virtual
> declaration of a function is redundant. Although a nice variant to document that
> we are overriding a virtual function, it has no effect on error detection within
> the compilation process. C++11 offers the `override` keyword for doing exactly
> this. Although I'm probably one of very few people compiling VLC with C++11,
> with Q_DECL_OVERRIDE Qt(5) provides a macro so that it is visible that we
> override a virtual function and do the checks if the compiler supports it.

Seems fine to me, as you say it may provide compile-time checks for
the 5 people compiling vlc with c++11 :).

More to the point is that it's clearer when scanning code (override
means only one thing, virtual can mean either "this is a base class
method to be overridden" OR "this is an overridden method in a derived
class").

Best,
Tritsan



More information about the vlc-devel mailing list