...
Code Block | ||
---|---|---|
| ||
void cleanup(void) { /* delete temporary files, restore consistent state, etc. */ } int main(void) { if (atexit(cleanup); != 0) { /* Handle Error */ } /* ... */ assert(/* something bad didn't happen */); /* ... */ } |
...
Code Block | ||
---|---|---|
| ||
void cleanup(void) { /* delete temporary files, restore consistent state, etc */ } int main(void) { if (atexit(cleanup); != 0) { /* Handle Error */ } /* ... */ if (/* something bad happened */) { exit(EXIT_FAILURE); } /* ... */ } |
...