Re: I wish exceptions would give you access to the stack trace
marlow.andrew@gmail.com (Andrew) wrote (abridged):
I wish exceptions would give you access to the stack trace like they
do in Java.
Why?
Does no-one else think this would be a good thing?
For me the benefit would be minimal. Generally I need only to know the
stack when diagnosing bugs, and then I can get it from a crash dump or
from a debugging tool.
Indeed, I like my exception handling to be simple, and to not depend very
much on what the exception is. So exceptions are the last place I'd need
a stack trace. If I do need to know something about the context in which
a call happens, I can manage it explicitly, and at a higher level of
abstraction. A stack trace is a rather low-level, implementation-specific
way of thinking about code. It's useful when debugging, but not something
to design real code around.
I suppose some C++ers would be worried about the runtime and
memory consumption costs.
It is indeed difficult to see how to fit this with the "only pay for what
you use" principle.
-- Dave Harris, Nottingham, UK.
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]