r/cpp • • Mar 04 '22

Is it unreasonable to ask basic compiler questions in a C++ developer interview?

I interviewed a guy today who listed C++ on his resume, so I assumed it would be safe to ask a bit about compilers. My team works on hardware simulation, so he's not going to be expected to write a compiler himself, but he'll obviously be required to use one and to write code that the compiler can optimize well. My question was "what sorts of optimizations does a compiler perform?" Even when I rephrased it in terms of -O0 vs. -O3, the best he could do was talk about "removing comments" and the preprocessor. I started out thinking a guy with a masters in CS might be able to talk about register allocation, loop unrolling, instruction reordering, peephole optimizations, that sort of thing, but by the time I rephrased the question for the third time, I would have been happy to hear the word "parser."

There were other reasons I recommended no-hire as well, but I felt kind of bad for asking him a compiler question when he didn't have that specifically on his resume. At the same time, I feel like basic knowledge of what a compiler does is important when working professionally in a compiled language.

Was it an unreasonable question given his resume? If you work with C++ professionally, would you be caught off guard by such a question?

335 Upvotes

335 comments sorted by

View all comments

1

u/2048b Mar 15 '22

He might have experience writing working functional C++ programs that run for school or personal projects, but not the expert or professional who knows the nitty gritty details of C Compiler. He might know the language syntax, pointers, references, structs and classes, and produce working codes that compile and run without crashing.

College and school don't teach everything. On the contrary, I have the feeling they just teach the basics to introduce a student to something.

I guess it's just a case of mismatched skills and expectations like many applicant candidates. If you're looking to hire fresh college grads, do cut them some slack. Unless it's someone who indicates 10 years of C/C++ professional experience, then I would think it smells like self inflation on resume to get a job/interview.

Ultimately, if it's something that you as a hiring manager feels is a must-know critical knowledge for your job, then you're free to ask if a candidate knows anything about it. There might be other C++ jobs with other projects or companies that would do fine with this candidate which do not require the depth of knowledge that you require.

1

u/CocktailPerson Mar 15 '22

not the expert or professional who knows the nitty gritty details of C Compiler

To be fair, those are language-agnostic optimizations, and they're pretty light on detail. They were things I learned in undergrad while building a compiler for a python-like language.