diff options
Diffstat (limited to 'manual')
-rw-r--r-- | manual/search.texi | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/manual/search.texi b/manual/search.texi index 509a54313a..8aff57433a 100644 --- a/manual/search.texi +++ b/manual/search.texi @@ -180,11 +180,10 @@ This can make a difference when the comparison considers only part of the elements. Two elements with the same sort key may differ in other respects. -If you want the effect of a stable sort, you can get this result by -writing the comparison function so that, lacking other reason -distinguish between two elements, it compares them by their addresses. -Note that doing this may make the sorting algorithm less efficient, so -do it only if necessary. +The addresses passed to the comparison function need not correspond with +the original location of the objects, and need not even lie within the +original array. The only way to perform a stable sort with @var{qsort} +is to first augment the objects with a monotonic counter of some kind. Here is a simple example of sorting an array of doubles in numerical order, using the comparison function defined above (@pxref{Comparison |