gtpc2m20 | C/C++ Language Support User's Guide |
This function ends a program.
Format
#include <stdlib.h> void exit(int return_code);
TARGET(TPF) restriction |
---|
The return_code must be from 0 to 0x00FFFFFF. If nonzero, a system error bearing this identification number is issued before exiting. |
Using the exit function is one way to cause normal program termination. (The other ways are calling the basic assembler language (BAL) EXITC macro and returning from the initial main function.) During normal program termination:
TARGET(TPF) restriction |
---|
Coding a nonzero return code as the argument will result in a system error dump. |
Normal Return
The exit function does not return to its caller. This function gives control to the TPF system, which exits the ECB. If the ECB was created by a parent ECB through the system or tpf_cresc functions, or the BAL CRESC macro, the TPF system reactivates the parent ECB. For example, if program A calls program B through a call to the system function, and program B calls the exit function, program B exits and program A resumes running at the next sequential instruction (NSI).
Error Return
Not applicable.
Programming Considerations
TARGET(TPF) only consideration |
---|
Coding a nonzero argument results in a system error with exit. |
TARGET(TPF) only consideration |
---|
The macros EXIT_SUCCESS and EXIT_FAILURE are provided for compatibility with other implementations, but their use is not recommended for TPF systems. |
TARGET(TPF) only consideration |
---|
If the return_code parameter is less than zero or greater than X'00FFFFFF', a system error with exit is generated (system error number that is not valid passed to exit function). |
TARGET(TPF) only consideration |
---|
No prefix character is concatenated with the system error number. Therefore, there is no way to distinguish between IBM and user exit calls that code the same system error number. |
Examples
The following example exits the ECB when processing is completed. No system error is issued.
#include <stdlib.h> int main(void)
·
·
·
exit(0);
Related Information