This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: Question regarding bizarre ','
On Aug 5, 10:20pm, Andrew Cagney wrote:
> > 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.
>
> This is true of enums (cf the alpha compiler) but not, I believe, of
> array initializers.
I am unable to find anything in Harbison and Steele which indicates
that a trailing comma is acceptable in an array initializer. (They
don't seem to mention it one way or another.)
I recall using some compilers in the past where a trailing comma in an
array initializer was definitely not accepted. In fact, I was told at
the time that some code I had written which had a trailing comma was
not standards compliant.
Kevin