John,
On 07/09/10 12:37, john.aynsley@doulos.com wrote:
> 1666-2005 has sc_report derived from std::exception, and for backward
> compatibility includes:
>
> typedef std::exception sc_exception;
>
> Should we mandate or recommend that user-defined exceptions thrown by
> throw_it are derived from std::exception?
Although it might be good practice in some cases, I would prefer not to
require derivation from std::exception. The thrown exceptions might be
used in similar scenarios (merely as tagged types) as sc_kill_exception
et.al., which do not need the overhead of std::exception.
We could recommend it, though. Especially if the exception is
uncaught, the implementation can actually provide some information about
the thrown object, if it is derived from a known interface.
> Would someone care to provide me with a definition of class
> sc_unwind_exception?
I've played around with the detection of completely swallowed kills and
resets, and have used the definitions attached below.
Note, that in this case, sc_unwind_exception is not derived from
std::exception and requires polymorphic usage in the catch clauses
(since it's abstract and does not have a public (copy) constructor).
The constructors/destructor might not be needed in the standard, but
are used in the implementation to do the error checking.
Greetings from Oldenburg,
Philipp
-- // from sc_except.h
class sc_unwind_exception
{
virtual bool is_reset() const = 0;
protected:
sc_unwind_exception();
sc_unwind_exception( const sc_unwind_exception& );
virtual ~sc_unwind_exception();
};
class sc_reset_exception
: public sc_unwind_exception
{
public:
virtual bool is_reset() const { return true; }
};
class sc_kill_exception
: public sc_unwind_exception
{
public:
virtual bool is_reset() const { return false; }
};
-- Philipp A. Hartmann Hardware/Software Design Methodology Group OFFIS R&D Division Transportation | FuE-Bereich Verkehr Escherweg 2 · 26121 Oldenburg · Germany Phone/Fax: +49-441-9722-420/282 · PGP: 0x9161A5C0 · http://www.offis.de/ -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean.Received on Tue Sep 7 04:31:05 2010
This archive was generated by hypermail 2.1.8 : Tue Sep 07 2010 - 04:31:07 PDT