Thanks Bart, this is strange. Using you example I got the value -16. I am using fpc 2.6.4 on a Linux 64 bits machine. I do not get why I got a different value than you. And in my case, the strange behavior is that AnsiCompareStr in the same unit but in two different application gave two different results. I wonder if somebody else got observed this?
I also noticed that using CompareStr, I got the value -16 and the funtion give the same result on both application. The code where I observe this are rather large, so it is difficult to share. But if I manage to recreate this situation in a more simple context, I'll post a bug report. Thanks again for your help, Gilles Marcou Le samedi 05 mars 2016 à 13:01 +0100, Bart a écrit : > On 3/5/16, Marcou Gilles <[email protected]> wrote: > > > > I checked the AnsiCompareStr value between these two string and found > > that the same unit compiled into one application give the value 16 and > > compiled into the other application, it return the value -28. > > {$apptype console} > {$ifdef fpc} > {$mode objfpc} > {$h+} > //{$codepage utf8} > {$endif} > > uses SysUtils; > var > S1,S2: AnsiString; > > begin > S1 := 'C-C'; > S2 := 'C=C'; > writeln('AnsiCompareStr(''C-C'',''C=C'') = ',ansicomparestr(S1,S2)); > end. > > > C:\Users\Bart\LazarusProjecten\ConsoleProjecten>fpc test.pas > Free Pascal Compiler version 3.0.0 [2015/11/16] for i386 > Copyright (c) 1993-2015 by Florian Klaempfl and others > Target OS: Win32 for i386 > Compiling test.pas > Linking test.exe > 16 lines compiled, 2.5 sec, 64048 bytes code, 4052 bytes data > > C:\Users\Bart\LazarusProjecten\ConsoleProjecten>test > AnsiCompareStr('C-C','C=C') = 1 > > (Same result with fpc 2.6.4) > > Bart _______________________________________________ fpc-pascal maillist - [email protected] http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
