Re: [PATCH v2 0/5] string-list: make string_list_sort() reentrant
- From
Jeff King <peff@peff.net>
- Date
- Jan 24, 2017, 13:44 UTC
- Message-ID
- <20170124134430.am6yzskkcp2vq6a5@sigill.intra.peff.net>
- In-Reply-To
- <alpine.DEB.2.20.1701241233390.3469@virtualbox>
On Tue, Jan 24, 2017 at 12:44:10PM +0100, Johannes Schindelin wrote:
Show 14 quoted lines
> Hi Peff, > > On Mon, 23 Jan 2017, Jeff King wrote: > > > Is there any interest in people adding the ISO qsort_s() to their libc > > implementations? It seems like it's been a fair number of years by now. > > Visual C supports it *at least* since Visual Studio 2005: > > https://msdn.microsoft.com/en-us/library/4xc60xas(v=vs.80).aspx > > With René's patch, we have an adapter for GNU libc, and if anybody comes > up with the (equally trivial) adapter for BSD libc's qsort_r(), we have a > lot of bases covered.
Sadly, no. Microsoft's qsort_s() is not compatible with the ISO C one. And BSD's qsort_r() has a similar problem acting as a wrapper, because the order of arguments in the callback functions is different (so you'd have to actually wrap the callback, too, and rearrange the arguments for each call, or do some macro trickery).
Gory details are in:
https://stackoverflow.com/questions/39560773/different-declarations-of-qsort-r-on-mac-and-linux/39561369
and the original thread:
http://public-inbox.org/git/3083fbf7-d67e-77e4-e05f-94a7e7e15eba@web.de/
-Peff