|
Boost : |
From: Joaquín Mª López Muñoz (joaquin_at_[hidden])
Date: 2003-09-25 12:49:09
In the process of fine-tuning my indexed_set library I've received a
request to support the BOOST_NO_EXCEPTIONS mode. About this
macro the Boost.Config docs say:
The compiler does not support exception handling
The explanation is IMHO a little vague, because the two following
scenarios seem to conform to this mode:
1. No try and catch constructs allowed, but stack unwinding can result
from some other event (SEH exceptions, something like that.)
2. No try and catch constructs allowed, and stack unwinding will
never ever happen (except as part of the normal control flow, of
course.)
This makes a real difference when trying to honor BOOST_NO_EXCEPTIONS.
Consider the code:
try{
// perform some operation
}
catch(...)
{
// undo what has been done up until here
}
In the case #2, in order to support BOOST_NO_EXCEPTIONS one only
has to drop the whole try-catch thing:
// perform some operation: it won't be interrupted except for some hard
reset
// a la abort(), in which case we couldn't do anything anyway.
In the case #1, however, one would have to resort to some RAII construct
to
preserve the integrity of the program, along the spirit of commited
transactions.
So my question is: How do I have to handle the BOOST_NO_EXCEPTIONS
scenario?
Regards,
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk