GCC周围缺少大括号的初始化 [英] GCC missing braces around initializer

查看:647
本文介绍了GCC周围缺少大括号的初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的结构下,我要初始化所有零以下。我该如何摆脱失踪括号警告?

  typedef结构{
    uint32_t的来电[FRAME_TYPE_MAX]
    uint32_t的传出[FRAME_TYPE_MAX]
    uint32_t的超时。
    uint32_t的crc_errors;
} pkt_t;静态pkt_t统计= {0};


解决方案

这是GCC的bug#53119:

<一个href=\"http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119\">http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

如果你想看到它固定,张贴随访到的bug报告,指出这是一个问题给你。

I have this struct in C below that I want to initialize to all zero. How do I get rid of the missing braces warning?

typedef struct {
    uint32_t incoming[FRAME_TYPE_MAX];
    uint32_t outgoing[FRAME_TYPE_MAX];
    uint32_t timeouts;
    uint32_t crc_errors;
} pkt_t;

static pkt_t stats = {0};

解决方案

This is GCC bug # 53119:

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53119

If you want to see it fixed, post a followup to the bug report indicating that it's a problem for you.

这篇关于GCC周围缺少大括号的初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆