Where does interrupt () and end () live?

Regarding the completion handler,

As I understand it, when something bad happens in the code, for example, when we don’t catch the exception,

Called

terminate (), which in turn causes an interrupt ()

set_terminate (my_function) allows us to get terminate () to call the user-specified function my_terminate.

my question is: where do these functions "live", they do not seem to be part of the language, but work as if they are present in each individual cpp file, without having to include any header file.

+5
source share
3 answers

terminate abort, , , .

(, glibc Linux). , "" , . , main .

+5

, , :

int main() {
    abort();
}

:

error: 'abort' was not declared in this scope

C, ++ - "" - , - . ++ cstdlib exception. , # , , .

+3

set_terminate -

f .

- , , - . , , .

The default completion handler calls the cstdlib abort function

+2
source

All Articles