------- Comment #12 from shcherbakov at daad-alumni dot de  2010-01-05 16:27 
-------
I would also appreciate if an attribute like this is supported by gcc due to
several reasons:
  1. Developers that want to ensure that a virtual method actually overrides
another virtual method of a base class will have means of doing it
automatically (via this __attribute__). Basically, instead of checking every
method signature manually when an updated version of some C++ framework was
released, all checks can be done automatically.
  2. Provided that if this attribute is not used, the compiler behavior will
remain unchanged, nobody will get hurt. Those who don't use the attribute
(and/or don't know about it) won't have any difference, while those who do -
will have better user experience (e.g. if a noreturn function is not marked as
a noreturn, it is maybe a missed optimization chance, but not a problem to
those who don't know about "noreturn").
  3. Not supporting an extension until C++ committee states it is a strange
argument, as already GCC supports many time-saving functionality with backward
compatibility (e.g. printf() argument checking or __attribute__((noreturn)))
and nobody complains that they are not approved by C++ committee. As soon as
such extensions are not incompatible with "pure C++", they do not mean any
problems. 
  4. -Woverloaded-virtual won't help if a class is designed to contain several
overloads for a virtual method.
  5. Implementing support such attribute should not be a big problem (as the
VTABLE generation code that checks whether the method overrides another method
should just check one attribute and produce one error if it is defined).

To Andrew Pinski: If the proposed feature is still found to be unreasonable, I
am ready to discuss it and provide additional arguments.


-- 

shcherbakov at daad-alumni dot de changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pinskia at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17920

Reply via email to