News for hackers. Stuff that matters.
Re:C++ is a hack by kazinator on Tuesday February 16, 2016 @01:21PM (#11111928)
Overloaded operators do not have "canned" signatures that you have to memorize.

You generally design the signature. Some are unary and some are binary (or either), but you pick the argument types as well as return value.

The increment and decrement ones (++ and --) have a hack whereby an extra dummy argument of type int indicates "this is postfix" and isn't actually an argument which is making the operator binary! The argument isn't given a name.

Anyone halfway knowledgeable in C++ can be expected to know this piece of trivia, IMHO.

It's a huge hack, but the argument that it's something hard to remember that you have to Google for doesn't hold water.

Re:C++ is a hack by rootlocus on Tuesday February 16, 2016 @02:52PM (#11112653)
> It's a huge hack, but the argument that it's something hard to remember that you have to Google for doesn't hold water.

So basically you agree with the the fact that it's a hack, but feel that it's necessary to attack me personally (with a well placed "ad hominem" fallacy) for not being able to remember such trivia.

Let's make this clear: this isn't a test on how well you know C++. It's a rhetorical question, aimed at people how don't know C++, or only have a basic idea of how operator overloading works. Would they be able to guess which is overloaded how? No. Because it's an unintuitive hack.

That's the purpose of the question.

> Anyone halfway knowledgeable in C++ can be expected to know this piece of trivia, IMHO.

You can have your "humble" opinion (first one so far). I'll just have to humbly disagree with it.

Re:C++ is a hack by pcwalton on Tuesday February 16, 2016 @01:25PM (#11111962)
> Anyone halfway knowledgeable in C++ can be expected to know this piece of trivia, IMHO.

I disagree. Let me put it this way: You will not increase the quality of your C++ programmer hires by quizzing them on whether they know whether prefix or postfix gets the extra argument, or even how to overload those operators at all.

Re:C++ is a hack by kazinator on Tuesday February 16, 2016 @01:39PM (#11112076)
Only in the sense that someone who doesn't know C++ well could be a much better quality developer than someone who does.

If someone put C++ on their resume but doesn't know how to overload operators, they are failing on honesty.