News for hackers. Stuff that matters.
Re:The Technical Interview Is Dead by thrownaway2424 on Saturday June 22, 2013 @05:09PM (#5925150)
Technical interviews are perfectly good at doing what they are intended to do: screen out people who can't program. Somewhere between 50% and 80% of people I meet in first-round interviews literally just cannot program. Half of the people who say C++ is their strongest language can't tell me the difference between a pointer and a reference, or between a pointer to const and a const pointer.

I don't know if this problem is specific to our industry or not. Do people apply to be English teachers when it takes them an hour and a stack of reference material to form one English sentence? Do people apply to be carpenters who don't know how to hold a saw?

Re:The Technical Interview Is Dead by jimbobimbo on Saturday June 22, 2013 @09:44PM (#5925927)
Very good point about screening.

When I was interviewing people, phone screen with some basic concept questions would filter out 80% of applicants with nicely looking resumes; an hour-long whiteboard screen with FizzBuzz kind of problems would take care of the rest. Very quick and efficient process.

Re:The Technical Interview Is Dead by dennisgorelik on Sunday June 23, 2013 @05:31PM (#5929564)
If the end result - filter out every applicant -- I have quicker and more efficient process in mind.
Re:The Technical Interview Is Dead by casual_slacker on Saturday June 22, 2013 @07:20PM (#5925544)
I'm not a C++ programmer; what is the difference between a const pointer and a reference?
Re:The Technical Interview Is Dead by krob on Sunday June 23, 2013 @04:19AM (#5926652)
Pointer allows you to dereference a memory address. A reference is the physical memory address variable.

If you have a variable and you want to pass-by-reference, making any changes to the original variable effect the originally allocated value.

You use a pointer for instance if you want to dereference a physical memory address as part of an array of allocated memory addresses.

  // reference example
  int value = 0;
  int value1 = &value;
  value1 = 2;
  // value should equal 2

  // pointer example
  int value[5] = {1,2,3,4,5};
  *value += 1;value++;
  *value += 1;value++;
  *value += 1;value++;
  *value += 1;value++;
  *value += 1;
  // should now be {2,3,4,5,6}
Re:The Technical Interview Is Dead by dnc on Sunday June 23, 2013 @09:23AM (#5927468)
I'm not c++ programmer, so please correct me if I'm wrong, but I think that the reference example is not correct. Shouldn't it be as bellow?

    // reference example
    int value = 0;
    int& value1 = value;
    value1 = 2;
    // value should equal 2
Re:The Technical Interview Is Dead by thrownaway2424 on Sunday June 23, 2013 @12:56PM (#5928256)
Yes. And this subthread nicely proves the parent: At least half of people who claim to program in C++ can't.
Re:The Technical Interview Is Dead by Tyr42 on Sunday June 23, 2013 @08:31PM (#5930220)
That is more correct, yes.
Re:The Technical Interview Is Dead by sirmarksalot on Saturday June 22, 2013 @08:46PM (#5925791)
The syntax is different, but in terms of what you can do, the only difference I know is that references can be reassigned.

Both give you the guarantee that it's not pointing at the NULL address. In the case of const pointers, that's because you can't reassign it, and you'd never deliberately assign a const pointer to NULL. In the case of references, it's because there's actually no such thing as a null reference in C++.

That's not the case in Java and C#, which allow "null" to be a right-hand value for all types.

Re:The Technical Interview Is Dead by verroq on Saturday June 22, 2013 @08:53PM (#5925814)
>the only difference I know is that references can be reassigned.

Uhh no. Neither the const pointer nor the reference can be reassigned. And you have it the wrong way around. References cannot be null, pointers can.

The other difference is that if you try and dynamic_cast a reference and it failed, it throws an exception where as a pointer just returns nullptr.

>That's not the case in Java and C#, which allow "null" to be a right-hand value for all types.

That's also wrong, primitives are not nullable.

Re:The Technical Interview Is Dead by sirmarksalot on Saturday June 22, 2013 @09:22PM (#5925880)
Sorry, somehow I managed to forget that primitives existed for that brief moment. I was reacting to the realization that "null" is a bizarre special case for the type system.

I was wrong on reinitializing references as well. Thanks for pointing that out. As far as const pointers, I meant that they were unlikely to be null, since they would have to be initialized to null. Of course, then I realized that you could easily assign them to another null pointer that you didn't realize was null.

Not a good day for me, but I don't think it warrants that kind of snarkiness.

To my credit, please reread the part where I said "there is actually no such thing as a null reference."

Re:The Technical Interview Is Dead by verroq on Saturday June 22, 2013 @09:27PM (#5925892)
Well there is Nullable<T> for C#. But I haven't touched that language in ages.
Re:The Technical Interview Is Dead by mmorett on Monday June 24, 2013 @03:53AM (#5931568)
The best part of your reply is in showing how he failed his own interview, figuratively speaking of course. In real life, the candidate doesn't get to explain things the day after they were turned down because of bad answers.

I truly believe he knows his stuff, but even he made a mistake. He, however, didn't have to come up with his answer while people are staring at him.

Re:The Technical Interview Is Dead by seanmcdirmid on Saturday June 22, 2013 @08:57PM (#5925819)
A reference looks like a value but is actually a point (de-references are automatic). Most high-level languages prefer references over pointers as they are harder to screw up. E.g.

myref = otherref + 10

is equivalent to

* myptr = * otherptr + 10

Now, most languages also have a notion of values that are neither pointers nor references, and primitives generally are expressed as values, but hopefully you get the point.

Re:The Technical Interview Is Dead by thrownaway2424 on Saturday June 22, 2013 @08:43PM (#5925777)
A const pointer could be NULL, among many other differences.
Re:The Technical Interview Is Dead by jamesaguilar on Saturday June 22, 2013 @05:58PM (#5925288)
I wish I interviewed where you do. It is more like 90% for me.