3 ms·
When I was doing C++, one of my interview questions was an open ended one: "std::cout << "Hello world!" << endl;" What exactly is this doing, lets dive in to ho
by kevstev 3y ago
When I was doing C++, one of my interview questions was an open ended one: "std::cout << "Hello world!" << endl;" What exactly is this doing, lets dive in to how it works.
You touch on kind of a lot here, and its pretty esoteric to even devs with 3-5 years experience. functors, operator overloading, namespaces, passing by reference to make the << chaining work, there is a lot you really have to know that is non-obvious. You can even jump into inheritance, templates and such if you really want to dive deep.
I thought this was normal after doing C++ for ~11 years, but when I finally broke out of the Stockholm syndrome and started a job working in other languages, I find it absurd how complex, or maybe a better way to put it is, how much language specific trivia you need to learn before you can even begin to unravel how a basic hello world! program really works.
- imron 3y agoThat's a really great question. My favourite C++ question is asking what std::move does. It's amazing the knots people twist themselves into explaining how it supposedly works, when in reality it's just a type cast to an r-value so that the move constructor/assignment gets called instead of the copy one.
- intelVISA 3y agoFor me, it's asking about std::launder.
- lionkor 3y agoAre you selecting for people from the C++ standards commitee? :D
- dataflow 3y agoHow many people have answered your question correctly?
- intelVISA 3y ago0! It's not a huge deal, just expecting to hear a "wtf is that" vs. some feigned attempt to bs it.
- imron 3y agoNot gonna lie, had to look that one up.