Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Why is it that exiting at the end of main() requires a system call? Wouldn't a `ret` instruction go "back" to somplace where the OS itself will do cleanup work?

Usually that's done by the C runtime library, but there isn't one there since this is a freestanding environment. Had the program not exited through a syscall (or entered an infinite loop), it would most likely crash after veering off the main() function.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: