Portable qsort_r / qsort_s
Browse cluster: Cluster 204 →sort_r is a portable implementation of the reentrant quicksort function qsort_r/qsort_s, created by Isaac Turner in 2022. The project addresses the problem that different operating systems (GNU, BSD, and Windows) implement qsort_r with incompatible signatures, making it difficult to write portable code that needs to pass parameters to a comparison function without using global variables. The implementation provides a single sort_r() function that works across platforms and takes a comparison function along with a void pointer argument that gets passed to that function. The project is written in C, released into the public domain, and includes example code that can be compiled with make.