Where does abort() and terminate() "live"?

c++

Solution

If there are default handler functions for `terminate` and `abort` that you did not install yourself, they'd have to be in the runtime library provided by your compiler.

Normally, every program is linked against the runtime library (e.g. `glibc` under Linux). Among other reasons, this is because the runtime library contains "hidden" code for essential things, e.g. code that calls your `main` function at startup.

Problem

Regarding the terminate handler, As i understand it, when something bad happens in code, for example when we dont catch an exception, terminate() is called, which in turn calls abort() set_terminate(my_function) allows us to get terminate() to call a user specified function my_terminate. my question is: where do these functions "live" they don't seem to be a part of the language, but work as if they are present in every single cpp file, without having to include any header file.

Original source