Is there a difference between the on_exit() and atexit() functions?
c, linux
Solution
According to this link I found, it seems there are a few differences. `on_exit` will let you pass in an argument that is passed in to the `on_exit` function when it is called... which might let you set up some pointers to do some cleanup work on when it is time to exit.
Furthermore, it appears that `on_exit` was a SunOS specific function that may not be compatible on all platforms... so you may want to stick with atexit, despite it being more restrictive.
Problem
Is there any difference between ``` int on_exit(void (*function)(int , void *), void *arg); ``` and ``` int atexit(void (*function)(void)); ``` other than the fact that the function used by on_exit gets the exit status? That is, if I don't care about the exit status, is there any reason to use one or the other? Edit: Many of the answers warned against `on_exit` because it's non-standard. If I'm developing an app that is for internal corporate use and guaranteed to run on specific configurations, should I worry about this?