[Live-devel] [Patch] Don't exit(0) but abort() in case of unhanded error.

Ben Hutchings ben at decadent.org.uk
Wed Dec 30 08:47:39 PST 2009


On Wed, 2009-12-30 at 05:40 -0800, Ross Finlayson wrote:
> >Without this patch my VLC exists, pretending everything went fine.
> 
> As I noted in my earlier response (to someone else's question), this 
> call (and other calls) to "exit()" should be getting called only if 
> there's a serious problem in your code.  Are you actually seeing 
> this?  If so, you should figure out why.  And why do you feel that 
> "abort()" is better than "exit()"?  (Because you can catch it in a 
> signal handler?)

exit() will run functions installed with atexit(), and destructors for
C++ static objects, and so on.  abort() will kill the program quickly
rather than calling these functions while the program is already in a
bad state (just like a failing assert()).

Also, gdb (and presumably other debuggers) will break on unhandled
signals by default, but not on exit().

Ben.

-- 
Ben Hutchings
The obvious mathematical breakthrough [to break modern encryption] would be
development of an easy way to factor large prime numbers. - Bill Gates


More information about the live-devel mailing list