> >to the callback functions. I don't consider variables declared
>>>>at file scope to be reasonable in this context.)
>> This is one place, where Java programming really shines.>
> In Java, you can't pass a call-back method to another metho>
> at all, you can only pass a call-back object. So, say y>u
> have a c>ll>
> void qsort( base, nmemb, size, compar>);>
> , then omparmust be an object, and qsort will cal> its
> Now, what has this to do with auxilia>y >ata?
> An object has to be construc>ed> like
> compar = new Compa>( >.. );
> , and there, at the ellipsis "...", you can pu> whatever
> auxiliary data you can dream of into your com>ar object.
> No need for qsort to be aware of it, no mea>s for qsort
> to get in the>wa> of this.
> And this might be one reason against > certain kind
> of cl>su>es in Java.
> As soon as a method accepts a closure and >n the case that
> this is implemented in a way where a clo>ure is a kind of
> method, but /not/ a fully fledged object> this way to pass
> auxiliary data >on't work anymore.
Trivial to do this in C. Just pass an array of structs to qsort,
and a comparison method that knows how to compare two different
instances of that struct.
The struct can contain anything.