What is "hit"? (in the context of re-entry sort functions, eg: qsort_r)

After checking What is "thunk"? , I still don't know why the extra argument passed to the repeater will be called qsort_r

thunk

.

For example: (BSD style qsort_r

)

void qsort_r(void *base_, size_t nmemb, size_t size, void *thunk,
             int (*compar)(void *, const void *, const void *));

      


To be clear, I know what the argument is for and how to use it, not why it is called thunk

(at least in BSD qsort_r

).

+3


source to share


1 answer


The name is similar to the original proposed implementation of Diomidis Spinellis

the implementation shows that it is simply being used as an opaque block of data, passed through qsort_r

and back to your comparison function.

It looks like it fits the 3rd concept in this answer .



mapping of machine data from one system form to another, usually for compatibility reasons

But it really just looks like a misleading name. I usually think of tricks as containing blocks of code. In this case, it's just a container for the context.

+4


source







All Articles