[fpc-devel] Sorting tests

Michael Van Canneyt michael at freepascal.org
Tue Nov 29 10:21:04 CET 2022



On Tue, 29 Nov 2022, J. Gareth Moreton via fpc-devel wrote:

> Surely that's a bug in the comparison functions that should be fixed and 
> not something that can be blamed on introsort.  If a comparison function 
> is faulty, then pretty nuch any sorting algorithm can be considered to 
> have unpredictable behaviour.

No-one is blaming introsort.

It's about not breaking other software that depends on the sort mechanisms
provided by the RTL. They were documented as using quicksort.

Since we don't control the external functions, we cannot set introsort as 
the default till we know for sure that all external functions are OK with
that.

We of course could do that and just tell people to fix their implementation.

But that's not very friendly. From their point of view, their function is 
working fine (it may well be for quicksort which was the default mechanism), 
and we would break it.

Michael.


More information about the fpc-devel mailing list