From: Michael Snyder <msnyder@redhat.com>
To: Daniel Jacobowitz <drow@mvista.com>
Cc: Joel Brobecker <brobecker@gnat.com>, gdb-patches@sources.redhat.com
Subject: Re: Question regarding bizarre ','
Date: Mon, 05 Aug 2002 18:39:00 -0000 [thread overview]
Message-ID: <3D4F245F.6EAF1073@redhat.com> (raw)
In-Reply-To: <20020806012702.GA15122@nevyn.them.org>
Daniel Jacobowitz wrote:
>
> On Mon, Aug 05, 2002 at 06:21:35PM -0700, Joel Brobecker wrote:
> > This is where I show my lack of C-knowledge:
> >
> > in i386v4-nat.c, I read the following code:
> >
> > /* Mapping between the general-purpose registers in `/proc'
> > format and GDB's register array layout. */
> > static int regmap[] =
> > {
> > EAX, ECX, EDX, EBX,
> > UESP, EBP, ESI, EDI,
> > EIP, EFL, CS, SS,
> > DS, ES, FS, GS,
> > };
> >
> > I would have thought that the last ',' would cause a compilation error.
> > But this seems to compile fine. Any reason for keeping this last comma?
>
> It makes it easier to add an element without having to touch any
> existing line, to make diffs clearer. A trailing comma in an array
> initializer (or struct initializer maybe?) is ignored.
By most compilers, but some (possibly deviant ones) will give you
an error, or at least a warning. I have definitely encountered this
when building GDB, and I think most array and enum initializers in
gdb do not have the trailing comma for this reason.
Michael
next prev parent reply other threads:[~2002-08-06 1:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-08-05 18:21 Joel Brobecker
2002-08-05 18:26 ` Daniel Jacobowitz
2002-08-05 18:39 ` Michael Snyder [this message]
2002-08-05 19:20 ` Andrew Cagney
2002-08-06 16:15 ` Kevin Buettner
2002-08-06 16:44 ` david carlton
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=3D4F245F.6EAF1073@redhat.com \
--to=msnyder@redhat.com \
--cc=brobecker@gnat.com \
--cc=drow@mvista.com \
--cc=gdb-patches@sources.redhat.com \
/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