17
This is an interview question, the interview has been done.
What things can make C++ slower than C ?
The interviewer asked it very deep and always asked "anything else ? " whenever I said something.
My ideas:
C++ features not available in C may have some cost.
For example, if we use assignment to initialize class's members inside a constructor not by the initialization list, the member's default constructor may be called once before the body of the constructor, and then that value wiped out by the assignment.
Virtual functions need to be called by searching virtual function pointer. This is a overhead.
Any better ideas ?
Any help will be appreciated.
thanks !!!