Is there a g++ equivalent to Visual Studio#39;s __declspec(novtable)?(是否有与 Visual Studio 的 __declspec(novtable) 等效的 g++?)
问题描述
是否有与 Visual Studio 的 __declspec(novtable) 参数等效的 g++?
Is there a g++ equivalent to Visual Studio's __declspec(novtable) argument?
基本上,在纯虚拟基类中,__declspec(novtable) 参数可用于禁止为基类创建 vtable 以及在 contstructor/分别为析构函数.例如,
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.
我也没有在 命令行选项中看到任何编译器标志 与此优化有关.
I also don't see any compiler flag in the command line options relating to this optimization.
这篇关于是否有与 Visual Studio 的 __declspec(novtable) 等效的 g++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:是否有与 Visual Studio 的 __declspec(novtable) 等效的 g++?
基础教程推荐
- 我应该对 C++ 中的成员变量和函数参数使用相同的名称吗? 2021-01-01
- 通过引用传递 C++ 迭代器有什么问题? 2022-01-01
- 为什么派生模板类不能访问基模板类的标识符? 2021-01-01
- 如果我为无符号变量分配负值会发生什么? 2022-01-01
- 为什么 RegOpenKeyEx() 在 Vista 64 位上返回错误代码 2021-01-01
- 非静态 const 成员,不能使用默认赋值运算符 2022-10-09
- 初始化列表*参数*评估顺序 2021-01-01
- GDB 显示调用堆栈上函数地址的当前编译二进制文 2022-09-05
- CString 到 char* 2021-01-01
- 为什么 typeid.name() 使用 GCC 返回奇怪的字符以及如 2022-09-16
