A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://timsong-cpp.github.io/cppwp/n4140/alg.c.library below:

[alg.c.library]

25.5 C library algorithms [alg.c.library]

Table [tab:algorithms.hdr.cstdlib] describes some of the contents of the header <cstdlib>.

Table

113

— Header

<cstdlib>

synopsis


Type Name(s) Type: size_t Functions: bsearch qsort

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.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4