[fpc-pascal] AnsiCompareStr question (again...)
Tomas Hajny
XHajT03 at hajny.biz
Sun Mar 6 00:08:54 CET 2016
On Sat, March 5, 2016 23:51, Bart wrote:
> On 3/5/16, Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
>
>> One probably includes cwstring, while the other one doesn't.
>> AnsiCompareStr can be intercepted/replaced by widestring manages such as
>> cwstring.
>
> Sample from above on Linux 32-bit:
> [bart at localhost ConsoleProjecten]$ ./test
> AnsiCompareStr('C-C','C=C') = -16
>
> Same program, but now added cwstring to uses clause:
>
> [bart at localhost ConsoleProjecten]$ ./test
> AnsiCompareStr('C-C','C=C') = 28
Note that there may be a difference not only between the fallback
implementation and a real WideString / UnicodeString manager, but also
between WideString / UnicodeString managers used on different platforms -
as an example, we cannot guarantee that the results are exactly the same
on MS Windows (using its default Unicode string handling routines), Linux
with cwstring (depending on the iconv library), AIX with the IBM
implementation of iconv and OS/2 with yet another IBM implementation of
Unicode string handling routines.
If you want to ensure that the behaviour is exactly the same even for
various symbols, you should probably use fpwidestring - this results in
bigger binaries, but the same code is used across all supported platforms.
Tomas
More information about the fpc-pascal
mailing list