On Sep 2, 2010, at 10:42 AM, steve jaffe wrote:
C++ does provide the bare expression "throw;" which rethrows the currently- active exception. It may be a better design for nlopt code always to throw one
of the standard 5 exceptions but I don't think that is required by the
language. Am I missing something?

Unfortunately, the bare "throw" statement of C++ only works within the context of the catch block that caught the exception. It is useless in the context of what NLopt needs (catch the exception, set forced- stop, return from the callback function to execute a bunch of cleanup code in the C optimization routine, return to C++, re-throw an exception).

And, because C++ exceptions can have any type at all, there is no reasonable way to simply save the exception somewhere and rethrow it.

Steven

_______________________________________________
NLopt-discuss mailing list
[email protected]
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/nlopt-discuss

Reply via email to