News for hackers. Stuff that matters.
Re:Google's “Director of Engineering” Hiring Test by tptacek on Thursday October 13, 2016 @12:35PM (#12701989)
In C, what stat does is how you return multiple values from a function.

lstat has the same signature as stat: it passes the stat structure back through an output pointer.

Re:Google's “Director of Engineering” Hiring Test by philjr on Thursday October 13, 2016 @12:38PM (#12702014)
But not if you're a literal lunatic who thinks that because you literally used the word return with an error code that's what it returns. And. Only. That.
Re:Google's “Director of Engineering” Hiring Test by gknoy on Thursday October 13, 2016 @02:29PM (#12702932)
To be fair, the rest of the questions were demonstrably pedantic, and I would completely expect a question like this to be on the bill of fare:

   Q: What does lstat return?
   A: A struct
   >> Wrong, it returns an error code
That type of technical specificity about what well-known functions return is absolutely something I've heard people use as an interview question. Knowing it returns an error code (rather than the value you want) seems like a good indicator of "has actually coded in C" (whereas many other languages return the value you want and raise an exception if it had an error).
Re:Google's “Director of Engineering” Hiring Test by vram22 on Thursday October 13, 2016 @04:09PM (#12703640)
>In C, what stat does is how you return multiple values from a function.

IIRC, you can return structs from functions in C. You have to access the values in the returned struct with dot notation, of course, like point.x .

Pre-ANSI C may not have had this, but later, it did. Remember reading it in the 2nd (ANSI) edition of the Kernighan & Ritchie C book, and also used it myself in some programs.

https://www.google.co.in/?q=can+you+return+a+structure+in+c

Edit:

Might want to consider the cost of copying, depending on the perf requirements, size of the struct, whether the function call is in a tight loop, etc.

Re:Google's “Director of Engineering” Hiring Test by philjr on Friday October 14, 2016 @06:50AM (#12707239)
returning multiple values was the key part of the sentence