On Wed, Feb 06, 2002 at 10:25:43AM -0600, Kenneth Pronovici <[EMAIL PROTECTED]> wrote: > Which is more likely to be implemented? (I'm thinking there must have > been a reason for only allowing two criteria in the first place, and it > might have been to avoid the complexity of dealing with an arbitrary > number of sort criteria.)
A lot of the problem is that we use qsort to do the sorting, and we can't pass arbitrary numbers of parameters to the actual sort function we give it a pointer to. So we go through various contortions just to do two levels of sorting with minimal overhead. And we get even the two levels wrong, and AFAIK nobody has ever complained: we don't check whether sort_aux is reversed or not. So given how little people apparently use sort_aux, I think making the code far messier and probably slower for the common case to get even more levels of sorting (aside from two more levels of sorting when we sort by threads, which I do see the point of) is not a win. We could certainly write our own qsort, and maybe that's the thing to do to clean up the code. And we could also make the code a lot less messy by having some central sort function that qsort calls, which calls the right actual sorting functions based on global variable settings (we already do the global variable thing, but each individual sort function has to know about them, through messy macros, so it can call aux sort) but at the expense of an additional function call per compare, which may be a noticeable lose for big mailboxes. -Daniel -- Daniel E. Eisenbud [EMAIL PROTECTED] "We should go forth on the shortest walk perchance, in the spirit of undying adventure, never to return,--prepared to send back our embalmed hearts only as relics to our desolate kingdoms." --Henry David Thoreau, "Walking"