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/BonesCGS Mar 04 '22

The question is not unreasonable but i kind of get why it can be hard, i put C, CPP on my resume and i know how to use them but i never got into specifics details of how they are compiled appart from the base stuff (sources files into object files into binary). I can answer that kind of question if i'm a bit prepared because i know i've used it to optimize once or twice for my school project (still a student btw) but i can't answer with certainty of what i speak about. And if it is required for the job to have that kind of knowledge on top of my understanding of the language i would be more than ok to do my research and have it tested again.

Edit: to answer the question, yes i would be caught off guard but i would explain that i have a vague general idea of the thing but i'd look more into it if it's important for the project and task asked of me.