加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

已弃用的结构体成员C

发布时间:2020-12-16 06:04:02 所属栏目:百科 来源:网络整理
导读: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 __attri
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)的错误.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读