有一个g ++等价于Visual Studio的__declspec(novtable)? [英] Is there a g++ equivalent to Visual Studio's __declspec(novtable)?

查看:439
本文介绍了有一个g ++等价于Visual Studio的__declspec(novtable)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个g ++等价于Visual Studio的 __ declspec(novtable)参数?

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

基本上,在一个纯虚拟基类中, __ declspec(novtable)参数可以用来抑制一个用于基类的vtable以及在构造函数/析构函数中的vtable初始化/反初始化代码。例如,

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;
};

查看 Paul DiLascia的文章了解更多信息。另请参阅我的相关问题

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

推荐答案

我不认为有一个 - 如果有,它会列在类型属性页。 GCC使用类型属性为类型添加额外的注释(如对齐和填充),但没有类型属性等效于 __ declspc(novtable)

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.

我在中也没有看到任何编译器标志与此优化相关的手册页

这篇关于有一个g ++等价于Visual Studio的__declspec(novtable)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆