I've used it on larger teams where some enums for feature flags end up getting conflicts all the damn time when you add to the end because the last entry doesn't have a comma.
This might be fixed in various languages/parsers by allowing a trailing comma (e.g. python).
At the end of the day, clang-tidy, black, gofmt, rustfmt all the things and let's never talk about comma placement again.
That's only from C++11. The story I was telling you was from before then.
$ cat test.cc
enum Foo {
FOO,
BAR,
};
int main(int argc, char** argv) { return 0; }
$ g++ -std=c++98 -Wpedantic test.cc
test.cc:3:5: warning: comma at end of enumerator list [-Wpedantic]
3 | BAR,
|
$ g++ -std=c++03 -Wpedantic test.cc
test.cc:3:5: warning: comma at end of enumerator list [-Wpedantic]
3 | BAR,
| ^
$ g++ -std=c++11 -Wpedantic test.cc
How many code bases have you actually worked on?
I can tell you it's very common in constructor initializer-lists to the point that both the mozilla and webkit styles of clang-format does it.