[fpc-pascal] sort procedure of T(FP)List

Marc Santhoff M.Santhoff at t-online.de
Sun May 7 23:56:35 CEST 2006

Am Samstag, den 06.05.2006, 19:36 +0300 schrieb Geno Roupsky:
> 2006/5/6, Marc Santhoff <M.Santhoff at t-online.de>:
>         Am Freitag, den 05.05.2006, 11:03 +0300 schrieb Geno Roupsky:
>         > In fact you could have different function for every kind of
>         sort and
>         > switch them on the fly when the properties determining the
>         kind of
>         > sort that should be made changes. In my experience there is
>         no much 
>         > code duplication involved in this technique and you could
>         make for
>         > example one compare function for every field, after that you
>         make a
>         > _complex_ ones calling the simple ones.
>         The only thing I'm afraid of is stumbling into threading
>         issues in the 
>         future (most likely when I have fogotten the details of
>         sorting ;).
> It is the response of the compare function not the sorting one to
> synchronize whatever global(outside it's scope) variables is accesses,
> so no matter what approach you take you still will have issues with
> threads.

Yes, and it is much easier to deal with this in objects as instances of
classes than to do it on procedure level counting bytes with getmem

That's why i wanted to use a function of object (avoiding nasty
globals). I've written it already ans it is very clear and compact.


More information about the fpc-pascal mailing list