On Wed, Nov 02, 2011 at 05:55:44PM +0000, Steve Schwartz wrote: > Hazen, > > On Tue, 2011-11-01 at 22:28 -0400, Hazen Babcock wrote: > > > Check if there is an exit_handler > > > If so, pass control to it and on return execute a simple return > > Having thought a bit more, I can see that this would be pointless. > Having plexit return to the plplot module that called it can't help! > Thanks for refraining from calling this suggestion stupid. > > > > If not, then I guess crashing immediately might be best > > > > > > This gives the programmer the opportunity and responsibility to deal > > > with the error if they can/wish. > > > > The trick is to write your exit handler so that it does not return > > control to PLplot. > > Indeed, and could be quite tricky depending on the application but is > the best plplot could offer. I withdraw the subject line of this thread.
Steve, This is not at all a stupid question. In fact, it is rather an unfortunate historic artefact of plplot. In my opinion, libraries should never call exit(). Libraries should return control from a function call as gracefully as possible and set an error code. It is up to the application to decide what to do from there. For interactive languages then calling exit() is exceedingly irritating, just because of a plotting error. This topic has come up on the list before, but to fix it requires all plplot functions to return error codes. This is a major API change and would also require a lot of internal work to ensure errors were handled gracefully. Sadly C does not offer a nice way of exception handling unlike some more modern languages. Incidentally Debian's lintian program which checks packages for errors, non-standard behaviour etc complains about this. Andrew ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel