Bruno Haible wrote:
Richard B. Kreckel wrote:
I am imagining some Linux distribution where CLN is compiled with -fno-exceptions and a naive user is specifiying cl_reader_error to be called instead of exit. I haven't checked but I'm sure this will incur undefined behavior: a crash, a memory leak, you name it.
It will be a memory leak. Like when you use longjmp to abort a computation.
I thought so, too. But over here it crashes. It seems like Ron is making the same experience.
So, to be safe, the library will have to be compiled with exceptions enabled. But what is the advantage of providing such a callback then? I don't think anyone will do anything but throw exceptions from it!
Good point.
Just to think a bit further: Assume someone creates a C binding of CLN - this is a requirement brought up by RMS (such a thing existed a long time ago, but was unfortunately made with a proprietary ILOG tool) - how would the exception handling look like? Will it be a longjmp? Will it be a C++ exception handler?
I would suggest to whoever is going to write those that exceptions are caught in the C binding layer and transformed to return codes, messages, errno, or whatever inside that layer. -richy. -- Richard B. Kreckel <http://www.ginac.de/~kreckel/>