1530s, from L. exit "he or she goes out," third person sing. pres. indicative of exire "go out," from ex- "out" + ire "go." Also from L. exitus "a leaving, a going out," noun of action from exire. Originally in English as a stage direction (late 15c.); sense of "door for leaving" is 1786. The verb is c.1600, from the noun; it ought to be left to stage directions and the clunky jargon of police reports. Related: Exited; exiting.
1. A library function in the C and Unixrun-time library that causes the program to terminate and return control to the shell. The alternative to calling "exit" is simply to "fall off the end" of the program or its top-level, main, routine. Equivalent functions, possibly with different names, exist in pretty much every programming language, e.g. "exit" in Microsoft DOS or "END" in BASIC. On exit, the run-time system closes open files and releases other resources. An exit status code (a small integer, with zero meaning OK and other values typically indicating some kind of error) can be passed as the only argument to "exit"; this will be made available to the shell. Some languages allow the programmer to set up exit handler code which will be called before the standard system clean-up actions. 2. Any point in a piece of code where control is returned to the caller, possibly activating one or more user-provided exit handlers. This might be a return statement, exit call (in sense 1 above) or code that raises an error condition (either intentionally or unintentionally). If the exit is from the top-level routine then such a point would typically terminate the whole program, as in sense 1. (2008-05-15)