Remix.run Logo
listeria 2 hours ago

Well, if you're already using qsort_r, what's the point of using nested functions, if you can have a context pointer with the target?

And if you're not using qsort_r, but reaching for _Thread_local, the target can be _Thread_local instead of dsq.

uecker 2 hours ago | parent [-]

Fair. If you only have one object to access such as the target pointer, then it probably makes not much difference with void-pointer based APIs such as qsort_r (for new APIs it would add type safety). Where it removes more boilerplate code is when you have several such objects and would have to create an extra data structure to access them.