David Abrahams wrote:
There's no
reason in principle that a C++ system couldn't be written that
immediately detects way, _way_ more of the errors that lead to
undefined behavior and invokes a debugger immediately. Every pointer
dereference could be fully checked, for example.
Right - and there are systems that already do this. Valgrind (
http://www.valgrind.org/) springs to mind at this point. In the face of a
programming error, you want as much `undefined' behaviour as possible, to
give the tools that detect such behaviour the most information possible.
I think valgrind is the single most useful debugging tool on Linux, even
though I don't use it that often, much less frequently than a debugger, or
even printf() debugging[*]. AFAIU valgrind would be completely useless for
debugging java programs, which leaves a few possibilities: (1) the Java (or
D?) language design is such that bugs that are typically caught by valgrind
would never be made in the first place, or (2) Java debuggers already cover
this functionality, or (3) Java programs are harder to debug than C++
programs. I wonder which?