H. Verbeet wrote:
The C standard explicitly allows the comma at the end of initializer lists, this would be a style issue at best.
Not to contradict that, but, FWIW, I believe that a comma at the end of an enum list - specifically - is incorrect in ANSI C. The following code, compiled with -pedantic, produces a warning for the enum, alone.
int main() { enum days { Sunday, Monday, Tuesday, }; char s[] = { 'h', 'e', 'l', 'l', 'o', '\0', }; struct st_tag {int i; int j;} st = { 1, 2, };
return 0; }
compiled with "gcc [-ansi] -pedantic -o test test.c" produces "test.c:3: warning: comma at end of enumerator list".
I believe this exception has been removed in C99.