Table [tab:algorithms.hdr.cstdlib] describes some of the contents of the header <cstdlib>.
The contents are the same as the Standard C library header <stdlib.h> with the following exceptions:
The function signature:
bsearch(const void *, const void *, size_t, size_t, int (*)(const void *, const void *));
is replaced by the two declarations:
extern "C" void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); extern "C++" void *bsearch(const void *key, const void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *));
both of which have the same behavior as the original declaration.
The function signature:
qsort(void *, size_t, size_t, int (*)(const void *, const void *));
is replaced by the two declarations:
extern "C" void qsort(void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*)); extern "C++" void qsort(void* base, size_t nmemb, size_t size, int (*compar)(const void*, const void*));
both of which have the same behavior as the original declaration. The behavior is undefined unless the objects in the array pointed to by base are of trivial type.
[ Note: Because the function argument compar() may throw an exception, bsearch() and qsort() are allowed to propagate the exception ([res.on.exception.handling]). — end note ]
See also: ISO C 7.10.5.