4 ms·
What if C++ actually allowed that comma? Because... it does.
by agent327 5y ago
What if C++ actually allowed that comma? Because... it does.
- jcelerier 5y agonot everywhere, I often have a need for it in template arguments for instance for type lists: std::conditional< some_property< T, U, >, int, float, >; is a compile error, I really prefer std::conditional< some_property< T , U > , int , float >;
- fnord123 5y agoThat'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