din*_*rie 5 attributes gcc compound-literals
有了 GCC,我可以这样做:
typedef struct {
char a;
int n;
} MyStruct;
MyStruct ms __attribute__((section("MySection"))) = {'x', 33};
MyStruct *pms = &ms;
Run Code Online (Sandbox Code Playgroud)
但是,当我按如下方式使用复合文字时,GCC 会发出警告: 'section' 属性不适用于类型 [-Wattributes]。
typedef struct {
char a;
int n;
} MyStruct;
MyStruct *pms = &(MyStruct __attribute__((section("MySection")))){'x', 33};
Run Code Online (Sandbox Code Playgroud)
有什么办法可以过去吗?谢谢。
| 归档时间: |
|
| 查看次数: |
224 次 |
| 最近记录: |