News for hackers. Stuff that matters.
Re:Never trust a programmer who says he knows C++ by wheels on Monday March 29, 2010 @09:07PM (#1228030)
One funny consequence of this effect is that at 20 I listed like 15 programming languages on my resume; at 26 I listed 3.
Re:Never trust a programmer who says he knows C++ by jerf on Monday March 29, 2010 @10:40PM (#1228198)
I've long since taken C++ off of my resume, because I haven't used it for 10+ years, since I was in school. But because I'm a normal person for a HN reader, I've kept up with the news, and in learning so many other languages at one time or another have a pretty decent idea what's going on. Recently we started hiring for a C++ position, and I was asked to sit in on the interviews. I said that I didn't really know C++, but I do know enough other stuff to keep up.

Or so I thought. Our interviewer handed out a bit of code something like this

  int some_func(int, SomeComplexObject&);


  .. some code context...
  {
     {
         int a = 1;
         SomeComplexObject b = new SomeComplexObject()
         some_func(a, &b);
     }
     if (b = 0) {
         cout >> "Error" >> endl;
     }
   }
or whatever, something like that, and asked what was wrong. People with "years of experience" in C++ would strain and strain to find "the" error. This is of course a steaming pile of errors, the only legal code line is "int a = 1;" and that's redundant (just stick the 1 in the function call).

I don't have C++ on my resume, but after that experience I'm pretty sure I could put it back on without experiencing too much flak.

On that note, if you're into languages I really recommend the C++ FAQ Lite: http://www.parashift.com/c++-faq-lite/ Anybody who can follow that should probably just leave C++ on the resume. We all know C++ is massive, this is an interesting case study in how the massive language interacts with itself.

Re:Never trust a programmer who says he knows C++ by wheels on Tuesday March 30, 2010 @12:41AM (#1228395)
Though the point caries, out of nerdiness, I'll point out that most lines are in fact legal:

  int some_func(int, SomeComplexObject&);
Perfectly legal function declaration. You can omit variable names in the signature.

  {
    ...
  }
That defines a scope, which is also fine and occasionally used so that variable names can be recycled with other types later on.

  int a = 1;
You claim this is redundant; I'm not sure why

  if (b = 0) {
If there was a variable in scope named b, this would be legal (the one from above isn't), though probably not what's intended since it would always be false as it will contain the value assigned to b. This syntax is however sometimes used for things like:

  if((location = find_something()) != -1) {
All of that said, if somebody claimed "years of C++ experience" and didn't immediately notice loads of errors in this in about 2 microseconds, they're either a horrible programmer or a liar, and in either case you don't want to remotely consider hiring them.
Re:Never trust a programmer who says he knows C++ by jerf on Tuesday March 30, 2010 @11:05AM (#1229294)
The int declaration is redundant because you turn around and use it once, then it falls out of scope so you can't use it ever again. "int some_descriptive_name = 1; somehow_use(some_descriptive_name);" would be valid and I do things like that, but not with "a". (Barring some exceptional context where "a" really is descriptive; for example, encryption algorithms following the spec closely, which is just about the only exception I'll grant to "never use lots of single-char variable names".)

Yes, if (b = 0) { is syntactically correct but the odds of you meaning it are effectively zero.

The function declaration was legal, for the purpose of highlighting the call where the & is used incorrectly. Making that illegal would significantly complexify the task of saying where the error is. Of course it's such a steaming pile that it's arguable no matter how you slice it, that's what happens when your code is semantic nonsense.

BTW, I'm just clarifying, we're pretty much in agreement, just with different emphases.

(Also, I like the cout line, now that I look at it the next day. I'm tempted to slip that in to a test somewhere. It wouldn't be a "no hire" if it was missed in an interview situation, but it would be an interesting way of seeing how detail-minded the interviewee is.)

Re:Never trust a programmer who says he knows C++ by Todd on Tuesday March 30, 2010 @01:24AM (#1228461)
What about

  SomeComplexObject b = new SomeComplexObject()
This should probably be

  SomeComplexObject* b = new SomeComplexObject()
since the former news up an object and then invokes a copy constructor before losing the original reference and leaking.
Re:Never trust a programmer who says he knows C++ by masterj on Tuesday March 30, 2010 @01:55AM (#1228510)
It's also missing a semicolon.
Re:Never trust a programmer who says he knows C++ by wheels on Tuesday March 30, 2010 @01:32AM (#1228476)
I omitted the lines that were completely wrong, like that one. That assignment wouldn't compile at all.
Re:Never trust a programmer who says he knows C++ by Todd on Tuesday March 30, 2010 @02:51AM (#1228573)
Good points (wheels and masterj)
Re:Never trust a programmer who says he knows C++ by chasingsparks on Monday March 29, 2010 @10:02PM (#1228127)
I've been moving in the same direction. My question: which three?
Re:Never trust a programmer who says he knows C++ by plesn on Monday March 29, 2010 @11:05PM (#1228237)
Wow, I have to do a resumé and I'm depressed about myself. I'm nearly about to write:

Languages: C, Python, Haskell

Will code for food in Java,C++,C#,Whatever.

Re:Never trust a programmer who says he knows C++ by wheels on Monday March 29, 2010 @10:10PM (#1228145)
At that time (4 years ago, last time I did a resume) C++, C and Perl. I wouldn't list Perl now. There are some other languages I've worked more with in the last couple of years that I would only mention only if they were in the "nice to have" section of a job description, and duly noted as only "some familiarity with".