kicad-developers team mailing list archive
-
kicad-developers team
-
Mailing list archive
-
Message #12431
Re: Plethora of warnings from -Woverloaded-virtual
On Wed, Feb 19, 2014 at 06:17:05AM -0600, Dick Hollenbeck wrote:
> doubly public declaraions within classes...... Wayne and I have spent years and a
> fortune cleaning this up, and it still comes in at a pace that I can no longer stomach.
> THAT is the single biggest way to clean up the code base.
It's only a little stylish issue IMHO, but everyone has his priorities:D
> - Always in derived method, prepend it with 'virtual'. That way it
> is easy to see if something is intended to be that way ... and easy to
> change the base-methods if someone changes the signature. This doesn't
> help yet though with compilers checking your intentions.
>
>
> DH> NO. The virtual-ness is inherited. That is sufficient. The OP seems to not
> understand, like you do, that the virtual ness is inherited, and affects all calls to the
> similarly named functions in the derived classes. (His concern about const-ness coming
> and going is valid however, and is the essence of the risk we are trying to avoid.)
I don't fully agree with that. Everybody knows that virtual is inherited
(and it couldn't be in any other way, actually) but I find is way clear
if it's made explicit, while reading a class without having to cross
reference all the way to the parent which virtualized it.
Otherwise a similar argument could be done for 'automatics are obviously
seen as such since declared in the function body'. If we're going for
legibility I'd say the virtual is good.
> for old school compilers. That would allow us to start using the new keyword. I remain
> opposed to including the virtual in the derived classes also however.
Can't comment on this, first time I've heard of these keywords... seems
a tentative to javaize C++ to me :P
--
Lorenzo Marcantonio
Logos Srl
References