已弃用的结构体成员C

已弃用的结构体成员C,第1张

概述GCC 6.1.1给了我一个关于C代码的废弃声明警告 struct foo{ __attribute__ ((deprecated)) static const int a = 1;};dep.cpp:1:8: warning: ‘foo::a’ is deprecated [-Wdeprecated-declarations] struct foo ^~ GCC 6.1.1给了我一个关于C代码的废弃声明警告
struct foo{   __attribute__ ((deprecated)) static const int a = 1;};dep.cpp:1:8: warning: ‘foo::a’ is deprecated [-Wdeprecated-declarations]   struct foo          ^~~dep.cpp:3:50: note: declared here   __attribute__ ((deprecated)) static const int a = 1;

documentation表示“如果该变量在源文件中的任何位置使用,则已弃用的属性将导致警告.”

由于警告指向第一行(struct foo),这是否意味着警告是因为结构使用已弃用的成员引起的?
有没有办法使用静态const struct成员的deprecated属性?

GCC 4.9.3似乎没有给出警告.

解决方法 看来这是GCC> = 5.0( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71274)的错误. 总结

以上是内存溢出为你收集整理的已弃用的结构体成员C全部内容,希望文章能够帮你解决已弃用的结构体成员C所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1252084.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-07
下一篇 2022-06-07

发表评论

登录后才能评论

评论列表(0条)

保存