Topic: Duplicate exception handlers


Author: Ross Johnson <rpj@ise.canberra.edu.au>
Date: 2000/08/04
Raw View
Are duplicate exception handlers legal? That is, is an implementation
required to accept them, or are they a grey area in the standard,
(optional, undefined, non-portable)?

GNU C++ accepts them without any complaint
Sun C++ accepts them but gives warnings
MSVC++  rejects them as errors (apparently)

I have a situation where the following is a solution except for
MSVC++:

/* Don't let the application trap our private exception */
#define catch(e) \
 catch(private_exception) {throw;}\
 catch(e)

but of course this produces duplicate handlers where multiple
catch blocks are used. I now need to find another way around
this but am interested to know if it's supposed to be portable.

--
+----------------------+---+
| Ross Johnson         |   | E-Mail: rpj@ise.canberra.edu.au
| Info Sciences and Eng|___|
| University of Canberra   | FAX:    +61 6 2015227
| PO Box 1                 |
| Belconnen  ACT    2616   | WWW:    http://willow.canberra.edu.au/~rpj/
| AUSTRALIA                |
+--------------------------+

---
[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]