This is the mail archive of the
mailing list for the glibc project.
qsort_r argument order
- From: Dustin Lang <dstn at cs dot toronto dot edu>
- To: libc-alpha at sourceware dot org
- Date: Tue, 2 Dec 2008 12:22:10 -0500 (EST)
- Subject: qsort_r argument order
Apologies if this has come up before: it seems the mailing list archive
search program can't handle search words with underscores in them.
I suppose this comment is coming too late, but I really wish that the
qsort_r function had been done differently. As far as I can tell, qsort_r
is not part of any standard, but it exists in BSD (including Mac OSX).
For some reason that I can't comprehend, when it was added to glibc the
argument order was permuted.
extern void qsort_r (void *__base, size_t __nmemb, size_t __size,
__compar_d_fn_t __compar, void *__arg)
__nonnull ((1, 4));
void qsort_r(void *base, size_t nel, size_t width, void *thunk,
int (*compar)(void *, const void *, const void *));
Why?! As far as I can tell, the functions would otherwise be compatible.
Especially annoying is the fact that it still compiles -- it's only at
runtime that it explodes in a fiery mess. As the developer of a software
package that uses qsort_r and has to run on BSD and glibc, this is just a
pain in the @$$.
Argh. Time to add a bunch of stupid preprocessor QSORT_Rs to my code.