How to use -Wsuggest-final-types/methods?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I don't really understand this option.  I enabled it but it warns for
essentially all of my classes which have any virtual methods.  For
example if I have Foo.h:

  class Foo {
      virtual bool bar();
    ...
  };

then Foo.cpp which implements Foo.  And then in another header somewhere
else I inherit from Foo and implement bar() differently (as a virtual
function).  However when GCC compiles Foo.cpp it can't see the other
header, so I guess it assumes no one inherits from Foo and suggests it
should be marked final:

  Declaring type 'class Foo' final would enable devirtualization of N calls

I mean sure, it would, but that would defeat the entire point (as I
understand it).

I don't really understand how/where this option is meant to be used. 
Ditto for -Wsuggest-final-methods.



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux