abort. McGraw-Hill The Complete Reference Fourth Edition
Annons
Annons
762
C + + : T h e C o m p l e t e R e f e r e n c e
T he standard function library defines several utility functions that provide various commonly used services. They include a number of conversions, variable-length argument processing, sorting and searching, and random number generation.
Many of the functions covered here require the use of the header <cstdlib>. (A C program must use the header file stdlib.h.) In this header are defined div_t and ldiv_t, which are the types of values returned by div( ) and ldiv( ), respectively. Also defined is the type size_t, which is the unsigned value returned by sizeof. The following macros are defined:
Macro
MB_CUR_MAX
NULL
RAND_MAX
EXIT_FAILURE
EXIT_SUCCESS
Meaning
Maximun length (in bytes) of a multibyte character.
A null pointer.
The maximum value that can be returned by the
rand( )
function.
The value returned to the calling process if program termination is unsuccessful.
The value returned to the calling process if program termination is successful.
If a function requires a different header than <cstdlib>, that function description will discuss it.
abort
#include <cstdlib> void abort(void);
abs
The abort( ) function causes immediate abnormal termination of a program. Generally, no files are flushed. In environments that support it, abort( ) will return an implementationdefined value to the calling process (usually the operating system) indicating failure.
Related functions are exit( ) and atexit( ).
#include <cstdlib> int abs(int num); long abs(long num); double abs(double num);
Ladda ner
Annons