How to implement qsort_r
Eric Blake
eblake@redhat.com
Fri Dec 5 15:45:00 GMT 2014
On 12/05/2014 04:16 AM, Schwarz, Konrad wrote:
>> while the glibc shim calls merely
>> 'compar(a, b, NULL)' and compar() just ignores the 3rd parameter.
>
> Depending on the ABI, no?
Indeed. Most modern architectures pass the third argument as a
register, and the receiver never uses the third argument, then the
behavior is the same based on the ABI. But it is conceivable to have an
ABI where the function cast is not ABI-compatible. At any rate, the
patch as Yaakov proposed it does NOT use a shim, but actually compiles
three separate functions (qsort, qsort_r, __bsd_qsort_r) with the three
different semantics rather than going through shims.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 539 bytes
Desc: OpenPGP digital signature
URL: <http://sourceware.org/pipermail/newlib/attachments/20141205/3de3335b/attachment.sig>
More information about the Newlib
mailing list