Skip to content

Commit

Permalink
Remove references to things in the C standard library, fixes #258
Browse files Browse the repository at this point in the history
  • Loading branch information
ericniebler committed Feb 15, 2017
1 parent 1836ccc commit c9e4cc8
Showing 1 changed file with 1 addition and 70 deletions.
71 changes: 1 addition & 70 deletions algorithms.tex
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@
The following subclauses describe components for
non-modifying sequence operations,
modifying sequence operations,
sorting and related operations,
and algorithms from the ISO C library,
and sorting and related operations,
as summarized in Table~\ref{tab:algorithms.summary}.

\begin{libsumtab}{Algorithms library summary}{tab:algorithms.summary}
\ref{alg.nonmodifying} & Non-modifying sequence operations & \\
\ref{alg.modifying.operations} & Mutating sequence operations & \tcode{<experimental/ranges/algorithm>} \\
\ref{alg.sorting} & Sorting and related operations & \\ \hline
\ref{alg.c.library} & C library algorithms & \tcode{<cstdlib>} \\ \hline
\end{libsumtab}

\synopsis{Header \tcode{<experimental/ranges/algorithm>} synopsis}
Expand Down Expand Up @@ -4524,70 +4522,3 @@
\tcode{(last - first)/2}
swaps.
\end{itemdescr}

\rSec1[alg.c.library]{C library algorithms}

\pnum
Table~\ref{tab:algorithms.hdr.cstdlib} describes some of the contents of the header \tcode{<cstdlib>}.

\begin{libsyntab3}{cstdlib}{tab:algorithms.hdr.cstdlib}
\type & \tcode{size_t} & \\ \hline
\functions & \tcode{bsearch} & \tcode{qsort} \\
\end{libsyntab3}

\pnum
The contents are the same as the Standard C library header
\tcode{<stdlib.h>}
with the following exceptions:

\pnum
The function signature:

\begin{codeblock}
bsearch(const void *, const void *, size_t, size_t,
int (*)(const void *, const void *));
\end{codeblock}

is replaced by the two declarations:

\begin{codeblock}
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*));
\end{codeblock}

both of which have the same behavior as the original declaration.

\pnum
The function signature:

\begin{codeblock}
qsort(void *, size_t, size_t,
int (*)(const void *, const void *));
\end{codeblock}

is replaced by the two declarations:

\begin{codeblock}
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*));
\end{codeblock}

both of which have the same behavior as the original declaration. The behavior is
undefined unless the objects in the array pointed to by \tcode{base} are of trivial type.

\enternote
Because the function argument \tcode{compar()} may throw an exception,
\tcode{bsearch()}
and
\tcode{qsort()}
are allowed to propagate the exception~(\cxxref{res.on.exception.handling}).
\exitnote

\xref
ISO C 7.10.5.

0 comments on commit c9e4cc8

Please sign in to comment.