This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: qsort_r argument order
- From: Eus <eus at member dot fsf dot org>
- To: libc-alpha at sourceware dot org, Dustin Lang <dstn at cs dot toronto dot edu>
- Date: Tue, 2 Dec 2008 18:00:44 -0800 (PST)
- Subject: Re: qsort_r argument order
- Reply-to: eus at member dot fsf dot org
Hi Ho!
--- On Wed, 12/3/08, Dustin Lang <dstn@cs.toronto.edu> wrote:
> Hi,
[snip]
> 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.
>
> glibc:
>
> extern void qsort_r (void *__base, size_t __nmemb, size_t
> __size,
> __compar_d_fn_t __compar, void *__arg)
> __nonnull ((1, 4));
>
> BSD:
>
> void qsort_r(void *base, size_t nel, size_t width, void
> *thunk,
> int (*compar)(void *, const void *, const void
> *));
>
>
> Why?!
Exactly as you have said before, it is because qsort_r is not part of any standard.
So, the same argument can be made for BSD and Mac OSX: why they permute the parameters?
I am sure you will ask the same questions in their mailing lists if you develop your software primarily for GNU/Linux systems.
[snip]
> cheers,
> dstn.
Best regards,
Eus (FSF member #4445)
In this digital era, where computing technology is pervasive,
your freedom depends on the software controlling those computing devices.
Join free software movement today!
It is free as in freedom, not as in free beer!
Join: http://www.fsf.org/jf?referrer=4445