Programming Interview : How to debug a program?

Posted by Jake on Programmers See other posts from Programmers or by Jake
Published on 2012-11-10T23:21:09Z Indexed on 2012/11/11 5:21 UTC
Read the original article Hit count: 201

Filed under:
|
|

I was recently asked the following question in an interview :

How do you debug a C++ program ?

I started by explaining that programs may have syntax and semantic errors. Compiler reports the syntax errors which can be corrected. For semantic errors, various debuggers are available. I specifically talked about gdb, which is command line, and Visual Studio IDE's debugger, which has a GUI, and common commands. I also talked about debug and release version of code, how assertions should be used for debug build, how exceptions helps in automatic cleanup & putting the program in valid state, and how logging can be useful (e.g. using std::clog).

I want to know if this answer is complete or not. Also, I want to hear how other people will go about answering this question in a structured manner ?

Thanks.

© Programmers or respective owner

Related posts about c++

Related posts about interview