4 ms·
C++11 trivia.
by nfoz 13y ago
C++11 trivia.
- ajross 13y agoPretty 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.
- eridius 13y agoYou 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.
- FreezerburnV 13y agoI 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?
- koenigdavidmj 13y agoThese 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.
- ctdonath 13y agoIt'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.