News for hackers. Stuff that matters.
Re:Why C++ Is Not "Back" by Eliezer on Sunday December 02, 2012 @01:22AM (#4860333)
Oh God I know the answers to all those interview questions and I remember using all those features and it seems like an unimaginable Cthulhoid horror now.
Re:Why C++ Is Not "Back" by Someone on Sunday December 02, 2012 @05:00AM (#4860734)
I would not know the asnwers, possibly because many of them are phrased horribly. Some examples:

"How many ways are there to initialize a primitive data type in C++ and what are they?"

I guess the answer is two: implicitly at program startup or through assignment. But then, maybe he wants to differentiate between int j=0, int j(0), what constructors do in x::x : j(0){}, and whatever.

"What is name mangling in C++ and why is it used?"

There is no name mangling in C++. Some compilers do map names to C-compatible identifiers, but that is not C++'s business.

"What is a copy constructor and when is it used, especially in comparison to the equal operator?"

I do not have the standard at hand, but I would guess it has an equality operator and an assignment operator, or maybe even just 'assignment'.

"What is a Vector?"

What is that capital 'V' doing there? Should I assume a "using namespace std" and an "#include <vector>"?

"Why should you never throw an exception in a destructor?"

There is nothing wrong with throwing an exception in a destructor (well, it is a bit weird). Throwing one from a destructor is the no-no.

"What is the proper way to perform a cast in C++?"

Another trick question or badly phrased. What are the ways to cast values in C++? When are they appropriate?" or something like it would be better.

Re:Why C++ Is Not "Back" by DanWaterworth on Sunday December 02, 2012 @01:37AM (#4860365)
Same here. After I finished reading the article, I felt the need to program something in Haskell, just to get rid of the smell.
Re:Why C++ Is Not "Back" by ihaveajob on Sunday December 02, 2012 @02:46AM (#4860486)
It seems like this is the thread where you report 100% success in the questionnaire, so here I am. Actually, I code in C++, ObjC, JS/HTML5 and Python almost on a daily basis. I don't think I could have picked up all the others so quickly if I didn't have a strong C/C++ foundation.

It really helps to know what goes on under the hood. For that, I'd say C++ has strong didactic value.

Re:Why C++ Is Not "Back" by hexagonc on Sunday December 02, 2012 @11:19AM (#4861576)
You say, I don't think I could have picked up all the others so quickly if I didn't have a strong C/C++ foundation., but I ask you this: was it the C or the C++ foundation that helped you learn the others? I can see how knowing C could ease the transition to learning JS and ObjC since those both -- superficially at least -- have syntactic similarities to C. But how did knowing C++ help you with those languages, especially Python and HTML? Was it mere familiarity with programming in general that helped or was it something specific to C++?
Re:Why C++ Is Not "Back" by Syssiphus on Sunday December 02, 2012 @04:56AM (#4860727)
My C++ days are long gone and I too still know the answers to nearly all of the questions.

Lucky are the ones who have someone to teach them this stuff. If you have to find it out yourself it is an endless pain.

I think I could handle the Great Old Ones. But C++, never again.

Re:Why C++ Is Not "Back" by Luyt on Sunday December 02, 2012 @08:32AM (#4861120)
I once got this question from an interviewer, who was a senior dev on the project:

"What is a vtable?"

My answer was that it was the way in which a C++ compiler makes it possible to do polymorphism (calling base member methods through pointers to derived classes; virtual functions). The interviewer didn't agree with me and said that vtables have nothing to do with polymorphism and moved on to another question (about :: scoping). I didn't start to argue with him, and I got the job.

Re:Why C++ Is Not "Back" by jpatte on Sunday December 02, 2012 @10:25AM (#4861426)
That may be because there are several forms of polymorphism. What you had in mind was subtype polymorphism (aka substitution), while he might have had another form in mind like parametric polymorphism (aka generics). http://en.wikipedia.org/wiki/Polymorphism_(computer_science)

Btw I assume you meant "calling derived member methods through pointers to base classes" instead.

Re:Why C++ Is Not "Back" by Luyt on Tuesday December 04, 2012 @11:28PM (#4874881)
Yes, you are correct. I meant something like: animal->move_random(), where animal can be a dog, cat, or even a bird (with an extra z coordinate ;-).
Re:Why C++ Is Not "Back" by lrobb on Sunday December 02, 2012 @03:23PM (#4862367)
Some of my most enjoyable programming involved writing high performance multithreaded socket services with a copy of Advanced Windows at my side (back when tech books were relevant).

I do have a certain amount of nostalgia for the days when all programming was pretty much "close to the machine". Now we spend our time gluing frameworks and libraries together to create apps.