Re: is C++ worth it ?
On Tuesday, July 31, 2012 8:26:08 AM UTC+1, Stuart wrote:
On July 30, 2012 Stuart wrote:
[...]
Now I have the problem that I am bound to the Windows platform
(drivers), so when I do something wrong and get an Access Violation,
I'll get an BAD_ACCESS exception. This is actually a good thing because
my application does not shut down without a pip, but the stack is
unwound and the measurement machine returns to a defined state (stages
stopped, camera in idle mode). But unfortunately I have no more
information about where the Access Violation occurred since C++
exceptions are designed to be used in a different way. Well, this works
well for my StopException since I don't care which particalur action has
been performed when the user aborted the measurement, but in case
something went wrong, I'd like to see what happened.
That's a problem regarding the platform, *not* C++. The last
thing you want in such cases is for the stack to be unwound.
You want a dump of the state exactly where the error occurred.
A core dump, under Unix. (From what I understand, it's possible
to configure Windows to behave correctly as well.)
[...]
A perfect language would generate an exception with a stacktrace upon an
Access Violation, which is much more preferable to a Core Dump. For
those who actually want to have the core dump, the language should
generate such a dump when the exception is not caught (AFAIK, Win32 does
not offer a setting that generates dumps upon Access Violations).
How is unwinding the stack preferrable to a core dump. The
stack trace tells where you were, but doesn't offer any
possiblity to see the surrounding state at each level.
Unwinding the stack looses important information.
(Where I work, when we have such problems, the first step is to
recreate them in the Unix environment, where we can get a core
dump, with all of the essential information.)
--
James