How would you write a finally clause in C++?

Per Bothner per@bothner.com
Sun May 27 12:28:00 GMT 2001


Erwin Bolwidt <ejb@klomp.org> writes:

> When you want to write a try {} finally {} clause in C++ in a CNI method,
> how would you do that?

The standard C++ idiom is to use a helper class with a finalizer.  I
don't know of anything more convenient.  Look at the implementation of
JvSynchronize for an example.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/



More information about the Java mailing list