Re: on the matter of exceptions
On Mar 10, 12:40 am, Andrew <marlow.and...@gmail.com> wrote:
On Mar 9, 11:15 am, Thomas Richter <t...@math.tu-berlin.de> wrote:
Andrew schrieb:
The usual argument is that it is useful to have a core for
debugging. I agree that this is useful for UNIX
environments. It is not so useful on Windoze, where the
expectation seems to be to use the Visual Studio debugger
and run the program again, catching the assertion as it
occurs.
I guess this is more an argument against Windows than an argument
against asserts, then. Core dumps are extremely useful for analyzing
problems.
Maybe it does just boil down to how useful it is to have a core dump.
That depends on what is in the core dump.
Part of the answer to that question seems to be 'it is not very useful
to Windoze programmers but UNIX programmers often find it useful'.
I suspect that the main reason it's not useful to Windows
programmers is that they don't know how to get it, nor how to
use the debugger on it. (i'm currently a windows programmer,
and that's my case, anyway. our clients' machines don't have
visual studios installed on them, and when the program crashes,
i don't get a core dump. But if I did get one, I wouldn't know
how to tell Visual Studios to look at.)
Maybe the fact that some programmers find it very useful and
others prefer an exception which they may want to handle (see
below) means that it should be configurable.
It is, sort of. In most cases, the core dump is preferable, but
there are exceptions. In our Excel plug-ins, we use Microsoft's
structured exceptions, to avoid crashing Excel, even in cases of
segment violations and the like. Because assert isn't the only
issue: if you want to continue in case of assert, you also have
to continue in case of a segment violation, or whatever else may
occur. (A segment violation is, after all, an
assert(isLegal(p)). Implemented in hardware, for a very loose
definition of isLegal.)
Note that Java really doesn't do any better. Except that it
eliminates the core dump, and gives you its idea of what you
want to know, rather than all of the information. (If you've
ever had to track down a problem of JVM crashes on a Linux box,
you know what I mean. A core dump would be nice.)
--
James Kanze
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]