qsort.3: alphasort() and versionsort() are not suitable for 'compar'

In glibc 2.10, the prototypes of alphasort() and versionsort()
were changed so that the arguments switched from 'const void *' to
'const struct dirent **', to match the POSIX.1-2008 specification
of alphasort(). As such, compiler warnings will result if
these functions are used as the arguments of qsort().

    warning: passing argument 4 of 'qsort' from incompatible
    pointer type
    expected '__compar_fn_t' but argument is of type
    'int (*)(const struct dirent **, const struct dirent **)'

Therefore, remove the ancient NOTES text suggesting that
alphasort() and versionsort() can be used as suitable
'compar' arguments for qsort().

Reported-by: Rob Landley <rob@landley.net>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2015-04-19 09:07:51 +02:00
parent 57cc00ecbf
commit fccc2ad848
1 changed files with 0 additions and 8 deletions

View File

@ -102,14 +102,6 @@ The
.BR qsort ()
function conforms to SVr4, 4.3BSD, C89, C99.
.SH NOTES
Library routines suitable for use as the
.I compar
argument to
.BR qsort ()
include
.BR alphasort (3)
and
.BR versionsort (3).
To compare C strings, the comparison function can call
.BR strcmp (3),
as shown in the example below.