You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Peter Samuelson <pe...@p12n.org> on 2006/02/14 08:16:55 UTC
Re: svn commit: r18448 - trunk/subversion/include
[julianfoad@tigris.org]
> Fix a C'89 incompatibility.
>
> * subversion/include/svn_io.h
> (svn_io_file_del_t): Remove a trailing comma.
Truly I learn something new every day.
Sure enough, 'gcc -pedantic' warns about trailing commas in enum
declarations, but *not* about trailing commas when populating an array
or a struct. I wonder whose bright idea it was to consider the one
less valid than the others.
Weird. Thanks for the education.
Re: svn commit: r18448 - trunk/subversion/include
Posted by Julian Foad <ju...@btopenworld.com>.
Peter Samuelson wrote:
> Sure enough, 'gcc -pedantic' warns about trailing commas in enum
> declarations, but *not* about trailing commas when populating an array
> or a struct. I wonder whose bright idea it was to consider the one
> less valid than the others.
Oh! I didn't realise a trailing comma was allowed on an array or struct
initialiser list. I've been telling people in reviews that it's not. Sorry,
folks.
- Julian
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
RE: svn commit: r18448 - trunk/subversion/include
Posted by Wayne J <wa...@zk.com>.
>[julianfoad@tigris.org]
>> Fix a C'89 incompatibility.
>>
>> * subversion/include/svn_io.h
>> (svn_io_file_del_t): Remove a trailing comma.
>
>Truly I learn something new every day.
>
>Sure enough, 'gcc -pedantic' warns about trailing commas in enum
>declarations, but *not* about trailing commas when populating an array
>or a struct. I wonder whose bright idea it was to consider the one
>less valid than the others.
I don't believe it's an issue of correctness but rather practicality.
Allowing a comma on the end of an array initialization makes it easier
to write code that generates and array initialization as you don't have
to special case the last element:
puts("int my_array[] = {");
for(i=0;i < n; i ++)
printf("%d,", i);
puts("};\n");
...
My guess is that at the time this was evolving programmatically
generating enums was not popular ...
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org