Interview Questions

People claim that optimizing compilers are good and that we no longer have to write things in assembler for speed

C Interview Questions and Answers


(Continued from previous question...)

People claim that optimizing compilers are good and that we no longer have to write things in assembler for speed

Q: People claim that optimizing compilers are good and that we no longer have to write things in assembler for speed, but my compiler can't even replace i/=2 with a shift.

A: Was i signed or unsigned? If it was signed, a shift is not equivalent (hint: think about the result if i is negative and odd), so the compiler was correct not to use it.

(Continued on next question...)

Other Interview Questions