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

Do not think it is unreasonable. I would have followed up their "removing comments" answer with "how does removing comments optimize the compilation?"

During my EE university days, I worked for a small contracting firm. Right before my interview they gave me two paper tests, one covering general analog/digital electronics and circuit theory and another specific to the particular job focus, and a HP calculator. The president who interviewed me mentioned many interviewees refused to take the test and that I aced the electronics portion and the field specific test that I did a great job considering no background.

2

u/maredsous10 Mar 05 '22

Over the last 10-15 years, CS fundamental scope has seen a reduction at Universities.

Many schools now leave out the following from core curriculum:

  • Discrete Math

  • Programming Languages (historical perspective, language types {functional, imperative, declarative, etc.}, feature survey,)

  • Compilers

  • Theoretical CS

  • Operating Systems

  • Computer Architecture

1

u/CocktailPerson Mar 05 '22

I would have followed up their "removing comments" answer with "how does removing comments optimize the compilation?"

Honestly, at that point it was clear that compilers were complete black boxes to him, and I would rather move on than drilling him on stuff he clearly knows nothing about. He had no idea what the point of the question was, he bullshitted, and...that tells me all I need to know.