[fpc-devel] Sorting tests

Nikolay Nikolov nickysn at gmail.com
Wed Nov 30 07:30:02 CET 2022

On 11/30/22 01:57, J. Gareth Moreton via fpc-devel wrote:
> Familarity mostly.  More people are familiar with quicksort than 
> introsort. Are there any explicit code examples where quicksort 
> succeeds and introsort fails?  I'm told even Lazarus crashes (or used 
> to crash), so I'll be interested to see what code causes (or caused) it.

IIRC, Lazarus had a comparison function that returned a<a = false, which 
caused an infinite loop, not a crash. I don't remember the details, you 
should examine the source control history. The problem was fixed a long 
time ago in Lazarus, however it was decided not to change the default 
algorithm, but rather provide a plugable mechanism for changing the 
algorithm, hence the sortalgs unit provides several different options. 
FPC developers didn't want to have the bug tracker be filled with bug 
reports, caused by that (people would first assume it's a bug in the new 
FPC version if their code fails on a new FPC version, but works in the 
previous version).


More information about the fpc-devel mailing list