[PATCH v3 0/7] Use introsort for qsort
Adhemerval Zanella
adhemerval.zanella@linaro.org
Wed Sep 8 11:56:59 GMT 2021
On 07/09/2021 16:28, Paul Eggert wrote:
> On 9/7/21 11:07 AM, Adhemerval Zanella wrote:
>> we are providing
>> async-safeness depending of the input arguments (which is really a
>> bad interface).
>
> Many functions are async-signal-safe for some arguments but not others. The 'free' function is just one example. qsort is not at all unusual in this department. This sort of interface is "really bad" only in the sense that every function that is not async-signal-safe is "really bad".
My point it is confusing and leads to bad assumption from users, as ruby
shows.
>
>> My point is blocks neither closures are essential to provide different
>> sort algorithms with different strategies and constraints.
>
> If that's the point, then I disagree. qsort_r is there for a reason, and this reason applies to any sorting algorithm. Some callers can limp along without qsort_r, by writing code that is not thread-safe or whatever; but many callers really need qsort_r and a similar need would apply to any sorting algorithm.
I think you missed my point here, I was not advertise to not provide
a qsort_r like, but rather that the blocks extensions from BSD is
just an extension.
>
>>> > Would you like to work together to come up with a new API that addresses both of our concerns?
>> I am not against your suggestion
>
> That's a good way forward, then. Do you have an API in mind? If not, I can propose one.
Sure, but this is orthogonal to the change I am proposing here. May
we move forward in this direction first?
More information about the Libc-alpha
mailing list