Boost logo

Boost :

From: Eric Woodruff (Eric.Woodruff_at_[hidden])
Date: 2002-08-16 10:20:44


The program was only an example of the fact that the compiler only retains
the type of exactly what was thrown, so, a dereferenced std::exception* is
thrown as an std::exception, and not the actual instance type.

I was talking about the rethrow that is necessary on a call to join...
(thus, the reason why I wrote 2 paragraphs about thread exceptions at the
end of the message.)

----- Original Message -----
From: Victor A. Wagner, Jr.
Newsgroups: gmane.comp.lib.boost.devel
Sent: Friday, 2002:August:16 11:11 AM
Subject: Re: Re: Re: std::exception -- Re: Re: Re: Re:
Re:AttemptingresolutionofThreads&ExceptionsIssue

At Friday 2002/08/16 07:37, you wrote:
>The point is that thread exceptions can not be rethrown intact.

non-sequitur
would you care to try what I suggested in the original message? or are we
talking about something that has _nothing_ to do with the program you
presented?

>----- Original Message -----
>From: Victor A. Wagner, Jr.
>Newsgroups: gmane.comp.lib.boost.devel
>Sent: Thursday, 2002:August:15 11:26 PM
>Subject: Re: Re: std::exception -- Re: Re: Re: Re:
>Re:AttemptingresolutionofThreads&ExceptionsIssue
>
>
>One of use is clearly confused here....
>Change your example program as shown and tell me what happens.
>At Thursday 2002/08/15 16:55, you wrote:
> >Since the compiler always creates its own instance of an exception when
you
> >throw something, the following causes the invalid_argument to be sliced:
> >
> >
> >#include <iostream>
> >#include <stdexcept>
> >
> >int main () {
> > try {
> > try {
> > throw std::invalid_argument ("argument is
>invalid");
> > }
> > catch (std::exception& exception) {
> > throw exception;
>
>Change the above line to:
> throw;
>
> > }
> > }
> > catch (std::invalid_argument& exception) {
> > std::cout << "invalid argument found" << std::endl;
> > }
> > catch (std::exception& exception) {
> > std::cout << "generic std::exception found" <<
std::endl;
> > }
> >
> > return 0;
> >}
> >
> >This means that even with a valid std::exception& type caught from a
>thread,
> >it is impossible to have the user catch it as anything besides an
> >std::exception*. However, this may make it trivial to migrate to using
> >shared_ptrs of exceptions because the concrete exception types need not
be
> >known, thus, a wrapper can easily be written to rethrow exceptions as
> >shared_ptrs.
> >
> >The other option is to have to have disperate catching semantics for
calls
> >to thread.join () and a non-threaded function. While the user can specify
> >that the thread supports std::exception&, they will have to catch an
> >std::exception* (the user isn't responsible for deleting it) -- this may
or
> >may not be acceptable.
>[deleted]
>Victor A. Wagner Jr. http://rudbek.com
>PGP RSA fingerprint = 4D20 EBF6 0101 B069 3817 8DBF C846 E47A
>PGP D-H fingerprint = 98BC 65E3 1A19 43EC 3908 65B9 F755 E6F4 63BB 9D93
>The five most dangerous words in the English language:
> "There oughta be a law"
>
>_______________________________________________
>Unsubscribe & other changes:
>http://lists.boost.org/mailman/listinfo.cgi/boost
>
>_______________________________________________
>Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost

Victor A. Wagner Jr. http://rudbek.com
PGP RSA fingerprint = 4D20 EBF6 0101 B069 3817 8DBF C846 E47A
PGP D-H fingerprint = 98BC 65E3 1A19 43EC 3908 65B9 F755 E6F4 63BB 9D93
The five most dangerous words in the English language:
               "There oughta be a law"

_______________________________________________
Unsubscribe & other changes:
http://lists.boost.org/mailman/listinfo.cgi/boost


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