Re: Question on vector at()
On Mar 18, 5:46 pm, Juha Nieminen <nos...@thanks.invalid> wrote:
Ian Collins wrote:
Juha Nieminen wrote:
If I had to develop C++ programs without any kind of debugger, it
would be a real pain. Each small mistake, each small typo, would requir=
a long and laborious task of manually adding debug prints to try to
binary-search the location of the error... Horrible.
There is a school of thought that I am becoming more aligned with as my
TDD skills improve that says using a debugger on new code is a sign
flaws in your development process.
Well, I don't see the debugger telling me "your program
crashed here" any different from a compiler telling me "you
have a syntax error here".
Time. In order for the debugger to tell me anything, I have to
generate an executable, and run it under the debugger. The
compiler tells me a lot earlier.
But that's not really the point here. If the program crashes,
you do use the debugger on the core dump for a post-mortem, to
tell you where (supposing that the crash wasn't due to an
assertion failure, or the assertion failure was too deep down in
lower level code to tell you where you were in your code). A
lot of the time, however, the error will be detected by some
other type of unit test failure. And usually, the way the unit
test failed should give enough information to isolate the error
in less time than it takes to prepare a debugging session; in
fact, in most cases (not all), I find that the work necessary to
prepare a debugging session (deciding where to put the break
points, etc.) will reveal the error before you actually get to
the point of invoking the debugger.
Imagine if C++ compilers wouldn't tell you which one is the
line where you have the syntax error, only that there is a
syntax error somewhere. That wouldn't make much sense.
I'm not sure, but I wonder if you and Ian aren't talking about
different things. I know that I use the debugger for
post-mortems, to find out which line in my unit tests triggered
the crash. I also know, however, that using it interactively,
on a running program, rarely an effective means of debugging.
And that far too many people seem to use it instead of thinking,
which is never very effective.
James Kanze (GABI Software) email:firstname.lastname@example.org
Conseils en informatique orient=EF=BF=BDe objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=EF=BF=BDmard, 78210 St.-Cyr-l'=EF=BF=BDcole, France, +33 (0)1 30 2=
3 00 34