[e-lang] The Strong Exception Guarantee
David Hopwood
david.nospam.hopwood at blueyonder.co.uk
Mon Jan 29 23:51:05 CST 2007
David Wagner wrote:
> David Hopwood writes:
>
>>What is needed to make defensively consistent programming tractable in
>>the presence of non-local exits, is that "only calls that exit normally
>>have significant side-effects". I will call this the Very Strong Exit
>>Guarantee (since it is stronger than what the C++ community calls the
>>"Strong Exception Guarantee").
>
> Can you explain how this differs from the C++ community's notion of
> strong exception-safety?
C++ (as-typically-implemented, rather than as-standardized) is a
shared-state concurrent language. So, other threads can potentially
access objects that are being changed by the current thread, and the
"Strong Exception Guarantee" does not address this (it does not require
all objects accessed by the call to be locked, for example):
<http://www.boost.org/more/generic_exception_safety.html>
# The strong guarantee: that the operation has either completed successfully
# or thrown an exception, leaving the program state exactly as it was before
# the operation started.
The Very Strong Exit Guarantee also requires that any side-effects of a
call are isolated from other threads, unless and until the call completes
successfully.
I'm open to suggestions for a better name. Perhaps
"Concurrent Strong Exit Guarantee?" (It should apply to all non-local
exits, not just exceptions.)
> P.S. Incidentally, here is a fascinating article I ran into on the topic
> of interactions between exception-safety and pure functions in C++:
>
> http://erdani.org/publications/cuj-2003-12.pdf
Thanks for the reference.
The exception-safety analysis they present, as flawed and insufficient as
it is, just convinces me more strongly that language support for atomic
transactions is necessary.
(There is another static analysis of exception safety at
<http://publications.lib.chalmers.se/records/full_record/22854.html>;
I'll have to try and get a copy of that from the authors.)
--
David Hopwood <david.nospam.hopwood at blueyonder.co.uk>
More information about the e-lang
mailing list