lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On 30/05/2020 23:23, Sean Conner wrote:
It was thus said that the Great Phil Leblanc once stated:
On Sat, May 30, 2020 at 5:51 PM Lorenzo Donati
<lorenzodonatibz@tiscali.it> wrote:

Funnily enough, os.exit, by default, does less than what C exit function
guarantees, i.e. equivalent to returning from main (C has much uglier
looking alternatives for emergency exit).

This summarizes nicely my original point! :-)  The (not so uglier)
emergency exit in C would be _exit().

  The uglier one is abort().

  -spc

The problem seems so compelling that they added some more in C99 (_Exit) and in C11 (quick_exit with corresponding at_quick_exit):

https://en.cppreference.com/w/c/program

and note that only abort causes abnormal termination. Whereas:

exit
_Exit
quick_exit

all terminate the program normally. They only differ on the level of cleanup performed.

Cheers!

-- Lorenzo