Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a g++ equivalent to Visual Studio's __declspec(novtable)?

Is there a g++ equivalent to Visual Studio's __declspec(novtable) argument?

Basically, in a pure virtual base class the __declspec(novtable) argument can be used to suppress the creation of a vtable for the base class as well as vtable initialization/deinitialization code in the contstructor/destructor respectively. E.g.,

class __declspec(novtable) PureVirtualBaseClass
{
    public: 
       PureVirtualBaseClass(){}
       virtual ~PureVirtualBaseClass() = 0;
};

See Paul DiLascia's article for more info. Also see my related question.

like image 688
paxos1977 Avatar asked Nov 24 '09 04:11

paxos1977


1 Answers

I don't think there is one -- if there was, it would be listed under the type attributes page of the GCC manual. GCC uses type attributes to add extra annotations to types (such as alignment and padding), but there is no type attribute equivalent to __declspc(novtable) listed there.

I also don't see any compiler flag in the command line options relating to this optimization.

like image 71
Adam Rosenfield Avatar answered Oct 01 '22 13:10

Adam Rosenfield