Re: type_size_sort

From: Morten Welinder <mwelinder@gmail.com>
Date: 2005-12-07 11:51:44
> It's perfectly correct. If the same list was to be passed to
> create_sorted_list() twice it will come out exactly the same the second
> time as it did the first. The only thing to remark on is that the return
> above could be written as below instead:
>
>         return a - b;

That is not what the part  of the standard I quoted says.  It very
clearly forbids the sorting function from depending on the pointers'
values.  I can even see an implementation actually using this
requirement.

And it is well known that some qsort implementations will do nasty
things if the sorting order is not consistent.  I've seen Perl core
dumps on that account, although that is a while ago.

M.
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Wed Dec 07 11:52:18 2005

This archive was generated by hypermail 2.1.8 : 2005-12-07 11:52:25 EST