Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2001-08-03 18:09:05


I have not looked at the threading case in particular, but I do want to
weigh in on the side of "exceptions don't have to be errors". Exceptions are
appropriate where the execution model and (lack of) efficiency matches the
needs of the programmer. I've used exceptions successfully to allow users to
cancel long operations in a GUI app: I scattered occasional calls to the
function which polled for the cancel keystroke through my operations, and
threw an exception when it was found that the user had cancelled.

-Dave

----- Original Message -----
From: "Alexander Terekhov" <terekhov_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Friday, August 03, 2001 2:07 PM
Subject: Re: boost.threads [was RE: [boost] Re: sockets /network programming
Requirements]

>
> > A good attempt at bypassing the problem, but it doesn't cover all the
> > basis. This *ISN'T* really an exception but instead is an attempt at
> > program flow control.
>
> sorry, it is the same (ISO/IEC 14882:1998(E) pg 291):
>
> "Exception handling provides a way of transferring control
> and information from a point in the execution of a program to
> an exception handler associated with a point previously passed
> by the execution."
>
> > The problem is that code can still catch these
> > exceptions, even if you insure they are rethrown. Imagine, for
> > example, a catch block coded as:
> >
> > try
> > {
> > }
> > catch(...)
> > {
> > LogError();
> > exit();
> > }
> >
> > The programmer probably doesn't want LogError() called for this non-
> > error, and he definately doesn't want the program to exit.
>
> but then his code would never call thread::exit so there
> will be no problems. also, IMHO catch(...) without "throw;"
> or program termination is inherently flawed (e.g. who is
> supposed to delete the object thrown by not so smart pointer,
> etc) so i do not see any good reasons not to provide
> exception based thread::exit even w/o catch(...)
> workarounds.
>
> regards,
> alexander.
>
>
>
> Info: http://www.boost.org Unsubscribe:
<mailto:boost-unsubscribe_at_[hidden]>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>


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