Purposefully debugging without using a debugger?

后端 未结 20 1833
春和景丽
春和景丽 2021-02-01 08:49

In chapter 5 of \"The Practice of Programming\" Brian Kernighan and Rob Pike write:

As a personal choice, we tend not to use debuggers beyond getting a st

20条回答
  •  梦如初夏
    2021-02-01 09:39

    It depends on the situation for me. Using Visual Studio I tend to use the debugger far more than I do when programming in any other language, or OS. I almost never use it when I program in Linux. It is usually just faster to read over the bit that screwed up and analyze it in my head. I only ever fire up a debugger when it is some kind of strange pointer array related issue (ie: the XXth entry in a pointer array is wrong for some reason) that I can't see at first glance.

    That said, in Visual Studio, unless the bug is very obvious, I find that it is just as fast to throw in a breakpoint, and try what I was doing again to see what's happening.

    tl;dr: my reason for using a debugger as a last resort, is speed.

提交回复
热议问题