From: Uwe Dolinsky on
On Feb 23, 7:58 pm, Paul Bibbings <paul.bibbi...(a)gmail.com> wrote:
> "Marco Nef" <maill...(a)shima.ch> writes:
> > Some time ago I asked to change this in the new standard, so that virtual
> > must be repeated in derived classes. But the reply in this group was that
> > lots of old code would not compile anymore. That was a bad answer, as
> > compilers could have a flag to ignore such an additional security feature in
> > old code...
>
> I would be happy even with the flip side of your suggestion - leaving
> the standard as is with regard to the virtual specifier yet having a
> compiler flag that could turn *on* a non-standard requirement that the
> virtual specifier be given everywhere, as an extension.

This is exactly what Codeplay's offloadcpp does: it has a command-line
option
to enforce the use of 'virtual' on overriding methods. Declaring
overriders
with 'virtual' is sometimes suggested by coding guidelines
(for example C++ coding standards by Sutter/Alexandrescu) and having
this
command-line option helps enforcing them where required.

Offloadcpp also implements other switches to optionally limit the set
of
allowable C++ language features, for example to ban potentially
dangerous
C-style casts.


Best regards
Uwe Dolinsky
http://offload.codeplay.com


--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]