This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: EH in C (was: Re: (lack of) Thread-safe exceptions on AIX (gcc-2.95.1)
- To: llewelly at 198 dot dsl dot xmission dot com
- Subject: Re: EH in C (was: Re: (lack of) Thread-safe exceptions on AIX (gcc-2.95.1)
- From: Bill Tutt <rassilon at list dot org>
- Date: Tue, 1 Feb 2000 14:08:16 -0800 (PST)
- cc: Zack Weinberg <zack at wolery dot cumb dot org>, Bill Tutt <rassilon at list dot org>, Richard Henderson <rth at cygnus dot com>, gcc at gcc dot gnu dot org
On Tue, 1 Feb 2000 llewelly@198.dsl.xmission.com wrote:
>
>
> On Tue, 1 Feb 2000, Zack Weinberg wrote:
>
> > On Tue, Feb 01, 2000 at 12:49:01PM -0800, Bill Tutt wrote:
> > >
> > >
> > > On Tue, 1 Feb 2000, Bill Tutt wrote:
> > >
> > > > Which looks frightfully silly to me. If you're only talking about
> > > > synchrnous exception handling, I still don't see why C would need a
> > > > try/catch syntax since it doesn't have any useful understanding of the
> > > > exception state at all.
> > >
> > > Unless of course you do want to give C some understanding of the C++
> > > exception state, which I haven't seen anyone even come close to
> > > suggesting.
> >
> > I believe that is exactly what people want. To be more specific,
> > system libraries written in C need to be able to generate exceptions
> > in a C++ compatible fashion, and cope with exceptions thrown through
> > them from callbacks. The pthreads library is the obvious example
> > since it has a pseudo- exception facility built in
> > (pthread_cleanup_push).
>
Well, that either means your system library isn't all C code (the
easiest thing to do) or just means you want some mechanism in C to throw
some kind of exception, that C++ can catch.
Three possible choices are:
1) __throw; All alone by itself, passing utterly no state along with the
exception, and only catchable by C++ with catch(...).
That doesn't seem to make much sense.
2) __throw(<int expression); This would allow C++ to catch it with
catch(int i) and then do additional filtering based on the value of i.
(assuming its legal C++, and implementable)
3) What MS does. For details on what MS does to accomplish translating the
SEH exception into a C++ typed exception see:
http://msdn.microsoft.com/library/devprods/vs6/visualc/vccore/_crt__set_se_translator.htm
There may be other possibilites, but those are the immediate ones that
come to mind.
Bill