This is the mail archive of the newlib@sourceware.org mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: How to implement qsort_r


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

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]