Re: unexpected exception handler



"George" <George@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0226EB22-2ECE-4FA2-A915-7FD93942EB05@xxxxxxxxxxxxx
Do you think from technical point of view, it is possible to list all
the exceptions?

Yes and no. Generic library functions (like STL algorithms) can't really
do that, but they should a) carefully document exceptions they may
produce on their own, and under what conditions, and b) propagate
unchanged any exceptions that emanate from user-provided callbacks
(predicates, comparators, copy constructors, assignment operators and
the like). This allows the calling code to reliably know what exceptions
a library function may throw in the caller's particular circumstances.

On the other hand, high-level business logic functions can document all
exceptions they may throw. Functions at a module's boundary, at least,
should do that. They form the API for the module, and error handling
strategy is part of the API and should be documented.

I am not sure whether there are any potential
exceptions at runtime which we do not know at development time.

You sound as if exceptions just happen unpredictably, like earthquakes
or tornadoes. Computers are deterministic state machines. Exceptions
don't occur at random, they are thrown by some piece of code in your
application. You are basically saying that you have no idea what your
code is doing. That's not a good way to develop software.
--
With best wishes,
Igor Tandetnik

With sufficient thrust, pigs fly just fine. However, this is not
necessarily a good idea. It is hard to be sure where they are going to
land, and it could be dangerous sitting under them as they fly
overhead. -- RFC 1925


.



Relevant Pages

  • C library errors -> C++ exceptions
    ... Does anyone know of a mechanism whereby C library functions can be made ... IEEE 754 "exceptions" throw C++ exceptions. ... I note that the glibc documentation suggests that "traps" may be ...
    (comp.lang.cpp)
  • Re: C vs C++ in Embedded Systems?
    ... > Exceptions don't make any difference here. ... exceptional condition in a fully general function into the *spec* of the ... versions of library functions that may throw exceptions are always used, ... where the exception is caught at the lowest level (the wrapper), ...
    (comp.arch.embedded)
  • Re: Runtime error in Java 6
    ... There's one superiority for movement sum, and another for API ... The API remainder throws Exceptions, in chance because an API thief ... , some classes will be of the approximation flavor, others of the API ... are out of the coolest splendid flow. ...
    (comp.lang.java.programmer)
  • Re: a missing feature in VC debugger
    ... In the system I described above, where I had to make the code robust, the issue was that ... whenever an API failed, it threw an exception. ... maintaining proper operating system state of the other components. ... unfortunate that there's not really a clean way to handle hardware-based exceptions in ...
    (microsoft.public.vc.mfc)
  • Re: Is this the Right way TO release COM interface ?
    ... HRESULTs into C++ exceptions when #importing type libraries with VC ... function that converts an HRESULT to an exception. ... What function prototypewould you use for an API that can be used to ... Non-existance of the value must be ...
    (microsoft.public.vc.language)

Loading