是否允许在模板类的静态成员上__attribute__((节(".something")))?
is __attribute__((section(".something"))) on a static member of a template class allowed?
在以下示例中,clang正确地将相应的变量正确地放入了.aaa'和'.ggg'中。GCC在" .GGG"上工作,但不使用'.AAA'(类模板的静态成员变量)。
template<int I>
struct s{
__attribute__((section(".aaa"))) static int a[100];
};
__attribute__((section(".ggg"))) int b[100];
template<int I>
__attribute__((section(".aaa"))) int s<I>::a[100];
这是Clang的GCC错误还是自愿支持?
是否有很好的工作(除了使S ::一个全球而不是静态成员制作)?
注意:我省略了编译器版本,因为Godbolt上的所有GCC的所有版本基本上是同一件事https://godbolt.org/g/e5s0mi
gcc的正式文档说
如示例所示,使用带有全局变量而不是本地变量的部分属性。
。
本地链接=错误?如果类本身是本地,则静态成员变量是本地的。我会通过模板声明说其本地。
源
相关文章:
- C++ variable_name.attribute = x
- 需要帮助调试"attribute parser"!C++ 来自黑客排名的问题
- 为什么标准首选圆括号初始化为"make_<something>"?
- C++生成器 10.2 基于函数的优化状态"unknown attribute 'optimize' ignored"
- 禁止显示"use of the 'X' attribute is a C++17 extension"警告
- 什么是使用something::something:something mean(c++)
- C++14 类函数错误:"Object has no attribute 'value'"
- "Attribute is protected within this context"继承和 .h 和.cpp文件
- 是否允许在模板类的静态成员上__attribute__((节(".something")))?
- "stringstream>>something"的返回值是多少?
- 编译器"error: passing ‘const something’ as ‘this’ argument discards qualifiers"
- C++ 如果'something'不为空且不"0.0.0.0"
- 在 c++ 中混淆了 new something() 和 new something[]
- 使用 Python.h 时"AttributeError: 'module' object has no attribute 'argv'"
- std::算法友好的方式迭代'std::vector<std::vector<something>>
- 术语"attribute"在解析器的上下文中是什么意思?
- 如何阅读C++中的NetCDF "global attribute"
- 为什么在这种情况下是this->属性而不是this.attribute(C++OOP)?
- 使用 ::namespace::something 比 namespace::something 有什么好处
- ISO C++禁止声明无类型的"something"