This is the mail archive of the
pthreads-win32@sources.redhat.com
mailing list for the pthreas-win32 project.
#define catch?
- To: <pthreads-win32 at sourceware dot cygnus dot com>
- Subject: #define catch?
- From: "Scott McCaskill" <scott at 3dfx dot com>
- Date: Tue, 1 Aug 2000 12:27:47 -0500
- Organization: 3dfx Interactive
I noticed that pthread.h has a macro that defines 'catch'. (macro
reproduced here for convenience)
/*
* Redefine the C++ catch keyword to ensure that applications
* propagate our internal exceptions up to the library's internal handlers.
*/
#define catch(E) \
catch(Pthread_exception_cancel) \
{ \
throw; \
} \
catch(Pthread_exception_exit) \
{ \
throw; \
} \
catch(E)
This breaks the following legal C++ code (because there will be multiple
catch blocks for Pthread_exception_cancel and Pthread_exception_exit):
try {
// ...
}
catch ( some_exception ) { }
catch ( some_other_exception ) { }
Is this breakage really necessary? I understand the reason for this macro,
but perhaps it should at least be optional? For now, I checked out the tree
and commented it out to work around it (admittedly not a great solution, but
I'm not going to rewrite all my code to only use one catch per try).
Excellent library, BTW.. I'm quite happy to not have to rewrite a bunch of
thread synchronization code for multiple platforms.
--Scott McCaskill