|
From: sfeam <sf...@us...> - 2017-02-28 04:52:12
|
On Tuesday, 28 February 2017 10:38:04 AM Tatsuro MATSUOKA wrote: > This is related to bug #1913. > > In stdfn.c > > there stated > > > /* Calls the cleanup functions registered using gp_atexit(). > * Normally gnuplot should be exited using gp_exit(). In some cases, this is not > * possible (notably when returning from main(), where some compilers get > * confused because they expect a return statement at the very end. In that > * case, gp_exit_cleanup() should be called before the return statement. > */ > > > ***************************** > Normally gnuplot should be exited using gp_exit(). > *************************** I think the intended meaning is "If you were going to terminate the program by calling exit(), don't do that. Instead call gp_exit()." However the normal exit from main() in a C language program is by "return", not "exit()". So gnuplot's main() routine does not call either exit() or gp_exit(). Instead it calls gp_exit_cleanup() followed by "return". Thus it does exactly what the comment describes. > Excuse me for my writing without reading the code in detail. > gp_exit() seems to be used in many place in the code. > Therefore gp_exit() is surely used in current gnuplot. Yes. For example If you say gnuplot> exit gnuplot then it calls gp_exit(). > However, "gnuplot> exit" does not use gp_exit() as written in the > previous post. > > I feel that the message > > Gnuplot not exited using gp_exit(). Exit handlers may not work correctly! > > in debug_exit_handler in stdfn.c is better to be modified. I think you are correct that the message is not accurate. It would be better to say "Gnuplot not exiting normally. Exit handlers may not work correctly!" gp_exit() is one way of exiting normally, but exiting by return from main() is also a way of exiting normally. In your case (Bug 1913) I guess neither of these normal ways to exit is happening. Instead gnuplot is killed by the operating system because you hit the "X button". Ethan > Tatsuro |