From: Mike Frysinger <vapier@gentoo.org>
To: Luis Machado <luis.machado@linaro.org>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] [sim,rx] Silence warning that turns into a build error
Date: Thu, 8 Apr 2021 16:57:46 -0400 [thread overview]
Message-ID: <YG9uSk4NbHK96i8i@vapier> (raw)
In-Reply-To: <07869142-e6ce-b480-56dc-334f2108e4b0@linaro.org>
On 08 Apr 2021 17:23, Luis Machado via Gdb-patches wrote:
> On 4/8/21 5:16 PM, Mike Frysinger wrote:
> > On 08 Apr 2021 16:51, Luis Machado via Gdb-patches wrote:
> >> + FP_Parts a = {0, 0, 0, 0, 0};
> >
> > wouldn't it be simpler & equiv:
> > FP_Parts a = {};
>
> I find that it works, but I'm unsure if it is a standard way of doing it.
>
> The C reference says:
>
> "When initializing an object of struct or union type, the initializer
> must be a non-empty, brace-enclosed, comma-separated list of
> initializers for the members."
>
> So I went with the most obvious, as opposed to going shorter and more
> opaque.
my concern is more about having to tweak this whenever fields are added
or removed.
i couldn't remember if the ={} syntax was a C++ extension, or in C11.
if it's a C++ extension, i *think* ={0} will work even in C11.
-mike
next prev parent reply other threads:[~2021-04-08 20:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-08 19:51 Luis Machado
2021-04-08 20:16 ` Mike Frysinger
2021-04-08 20:23 ` Luis Machado
2021-04-08 20:25 ` Luis Machado
2021-04-08 20:57 ` Mike Frysinger [this message]
2021-04-09 12:17 ` Luis Machado
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YG9uSk4NbHK96i8i@vapier \
--to=vapier@gentoo.org \
--cc=gdb-patches@sourceware.org \
--cc=luis.machado@linaro.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).