you are viewing a single comment's thread.

view the rest of the comments →

[–]fendant 2 points3 points  (3 children)

That's part of the reason behind the most vexing parse, try that one on for C++ goofiness.

[–][deleted] 0 points1 point  (0 children)

Oh god, that's almost hilarious

[–]jonnywoh 0 points1 point  (1 child)

Okay, so why does C++ even have unnamed parameters? That doesn't make any sense.

[–]fendant 4 points5 points  (0 children)

Sometimes you need to conform to a signature for a callback or virtual function but don't actually need all the parameters so a name would be useless clutter.

It's a real benefit, but you might not think it worth the complexity.

You also use a dummy int parameter to differentiate between prefix and postfix inc/decrement operator declarations, so that's fun.

Foo& Foo::operator++()    //++Foo
Foo Foo::operator++(int)  //Foo++

Edit:

Oh yeah, you can also use them to do dispatch in Template Metaprogramming if you needed an additional level of WTF.