This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
Re: catch (...)
- To: reentrant <reentrant at yahoo dot com>
- Subject: Re: catch (...)
- From: Ross Johnson <rpj at ise dot canberra dot edu dot au>
- Date: Wed, 08 Aug 2001 13:52:39 +1000
- CC: pthreads-win32 at sourceware dot cygnus dot com
- Organization: University of Canberra, Information Sciences and Engineering
- References: <20010807154926.5288.qmail@web12305.mail.yahoo.com>
reentrant wrote:
>
> > #define PtW32CatchAll \
> > catch( ptw32_exception & ) { throw; } \
> > catch( ... )
>
> Seems like it might be more appropriate (possibly required by the pthread
> standard?) for this to have a prefix of "pthread_" and a suffix of "_np" for
> non-portable; potentially "pthread_w32_catch_all_np" or similar instead of
> ? The same holds true for other PtW32 prefixed items. It
> seems wrong to introduce another namespace.
>
You are probably right. If I recall correctly, it was
given a Win32 style name because it is Win32 specific
AND specific to MSVC++. Another weak argument for not putting
it into the _np namespace is that it's a macro standing
in for a compiler keyword rather than imitating a function.
Anyway, changing it now would require people to change their
code.
It can be used portably as follows:
#ifdef PtW32CatchAll
PtW32CatchAll
#else
catch(...)
#endif
{
// Exception handler of last resort
}
Or avoid all of this added complexity if you can by using
the plain vanilla C version of the library named pthreadVC.dll
which doesn't use exceptions internally.
Ross