nice thread :-)
am going to start using a debugger now...
cheers
maverix
I dont use a debugger. If you are in the habit of not ussing it, you learn to programm with "good techniques", like variable initialization, 'assert', log and debug own subroutines, buffer overflow control, correct error handling, ..... Practice and learn by doing is what teach you to avoid the situation that need a debugger.
If you use the debugger, you dont learn how to avoid "dark mistakes".
What do you do when you make a mistake?I dont use a debugger. If you are in the habit of not ussing it, you learn to programm with "good techniques", like variable initialization, 'assert', log and debug own subroutines, buffer overflow control, correct error handling, ..... Practice and learn by doing is what teach you to avoid the situation that need a debugger.
If you use the debugger, you dont learn how to avoid "dark mistakes".
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
I take it you rarely need to debug code that isn't YOUR OWN code, then? Or code that you wrote a long time ago?
Like so many things, a debugger is a tool. Use it when it's the right thing to do - you don't use a screwdriver to hammer in a nail, nor does a chisel make a particularly good screwdriver.
Adding for example an assert() is a good way to detect something went wrong, but if you want to know HOW you got to that situation a back-trace/call-stack is very handy to show that. Of course, for easily repeatable problems, the log will also tell you what happened - if it's detailed enough.
Logging is useful for finding the exact circumstances for the error condition.
Writing perfect code is great, but if you work in a group of people, there will probably be someone that doesn't produce absolutely bug-free code all the time [or someone that doesn't quite know how to use some functionality in the system], and this causes problems to where you may be the one to debug it - even if you didn't write the code that causes the bug.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
This is exactly what I disagreed about with brewbuck. Just using a debugger doesn't make you more efficient. On the contrary, it might make you less efficient. It takes far long to find out what has gone wrong with just eying or scanning your code than using the debugger.
The debugger is a tool, and you musn't be afraid to use it.
The debugger is, of course, not enough many times. Using safe versions of functions to catch buffer overruns and using asserts to check for bad program states helps a lot.
I would say it's on the contrary. IF you use a debugger, you learn to avoid these dark mistakes because you catch them quite easily and find, oh no, I really must add this and that to avoid all these silly mistakes in the future.
Btw brewbuck, if it looks like I know everything and I'm right and you're wrong, then I'm sorry. I never do mean it that way. I was simply disagreeing with your way, nothing more. I don't claim anyone of us are right.