[fpc-pascal] sorting and merging array of records

waldo kitty wkitty42 at windstream.net
Thu Jan 12 21:32:24 CET 2012


On 1/12/2012 14:11, waldo kitty wrote:
> but yet i find this in my debug output...
>
> 03597 5.04184917406000E+003 ..................... ** inserting record
> [...]
> 03597 1.20109577665600E+004 ..................... ** inserting record

i was looking at the wrong compare... i had thought i'd be "smart" and use 
strcomp but it has bit me arse! :lol:


function TTLEColl.Compare(key1, key2: pointer): sw_integer;
begin
   if PString(key1)^ = PString(key2)^ then
     compare := 0
   else if PString(key1)^ < PString(key2)^ then
     compare := -1
   else
     compare := 1;
//  compare := strcomp(PChar(key1),PChar(key2));
end;


i wonder why the difference?? reverting to the original code as above (note the 
commented out strcomp) and it is working... now, after scrolling thru a side by 
side diff) there are no dupes at all, YAAAAY!




More information about the fpc-pascal mailing list