Boost logo

Boost :

From: Alexander Terekhov (terekhov_at_[hidden])
Date: 2003-10-08 18:41:49


David Abrahams wrote:
[...]
> We all agree that termination is appropriate when an invariant is
> broken. What we don't agree on is the ability of outer-level calls to
> determine that an invariant is broken based on the type of exception
> thrown from an inner-level call. I believe that goes to the heart of
> my objections to ESes.

Well,

<quote>
          Consider the following example (only slightly contrived).

          X get(int i) throw(out_of_range);
          int find(X& x) throw()
          {
            for (int i = 0; i < size(); ++i) {
              if (x == get(i)) return i;
            }
            return -1;
          }

          ....

          Maybe the programmer knows that the function will never be
          called, or that the path containing the throw statement will
          never be executed.
                            ^
</quote> |
                            |
.. if nothing goes wrong! --+

http://www.bleading-edge.com/Publications/C++Report/v9607/Column2.rtf

regards,
alexander.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk