News for hackers. Stuff that matters.
Re:Cppquiz – Figure what a given C++ program does by nfoz on Monday December 02, 2013 @01:08PM (#6835313)
C++11 trivia.
Re:Cppquiz – Figure what a given C++ program does by ajross on Monday December 02, 2013 @01:31PM (#6835453)
Pretty much. I tried three questions:

Understanding the first rested on the fact that a friend function declaration requires that the relevant function declaration be present above it in the translation unit (e.g. friend int A::foo();" requires that "class A" be defined, even though the prototype is otherwise correct). Meaningless trivia, and something every compiler will remind you about instantly and clearly.

The second one was pretty straightforward and basically about understanding that a superclass constructor is invoked before the subclass constructor. That's certainly important to understand, but in my experience rarely misunderstood except by true OO newbies (basically the same behavior has to hold for any static type system with inheritance).

The third called a public virtual function through a superclass pointer and expected you to recognize that declaring the derived function private in the subclass that the object belongs to didn't matter. Again, trivia that doesn't correspond to any meaningful real-world code pattern.

I gave up after that. Yawn.

Re:Cppquiz – Figure what a given C++ program does by eridius on Monday December 02, 2013 @03:44PM (#6836381)
You gave up too early. How about the question that tests your knowledge of std::async behavior, in a way that has very real practical results? (very real in that if you don't understand the behavior, you're almost certainly using std::async incorrectly and with no benefit to your code).

Or the one that makes sure you understand that, if a function isn't declared virtual, then you get static dispatch instead.

Or, heck, the one that ensures you know that floating-point literals default to double, and that this fact affects function overload resolution.

Re:Cppquiz – Figure what a given C++ program does by FreezerburnV on Monday December 02, 2013 @02:26PM (#6835860)
I can't quite tell due to the medium of text, but you make it sound like that's a bad thing. Was that your intended response?
Re:Cppquiz – Figure what a given C++ program does by koenigdavidmj on Monday December 02, 2013 @07:06PM (#6837566)
These are all the sort of things that will cause me to figuratively slap you down in code review if you do anything that relies on them.

The next logical step is to start defining or disallowing more of the undefined ones.

Re:Cppquiz – Figure what a given C++ program does by ctdonath on Monday December 02, 2013 @08:26PM (#6837900)
It's not about writing code that relies on these things. It's about knowing what things really do when most people think they do something else.