[Lazarus] Beyond Compare 4 built with Lazarus 1.2

Michael Van Canneyt michael at freepascal.org
Sat Dec 28 13:25:25 CET 2013



On Sat, 28 Dec 2013, Jürgen Hestermann wrote:

> Am 2013-12-28 12:46, schrieb Michael Van Canneyt:
>>> Even when looking into documentation there is no information about
>>> which string encoding the routines use/need.
>>> For example, not a single word about string encoding here:
>>> http://www.freepascal.org/docs-html/rtl/sysutils/findfirst.html
>> For a simple reason: currently, in the released version of FPC, there is no 
> need to document encoding.
>
> ??.
> So I can use any string type I like for the path of FindFirst?
> Strange.

No. Ansistring.

>> The language guide clearly states that in Delphi mode, String = Ansistring.
>
> What language guide?

The Object Pascal Language guide.

http://www.freepascal.org/docs-html/ref/ref.html

Specifically

http://www.freepascal.org/docs-html/ref/refsu10.html#x33-360003.2.4


> If I look at the web documentation of FindFirst there is
> absolutely *no* information about the string type of the path.
> Why not? It should be the reference.
> It does not even tell me that it is a string:
>  const Path: ;

Aha. That was a bug in fpdoc when releasing 2.6.2. Normally, it should read

const Path: string;

My apologies, I thought this had been fixed since the release :(

> What should the user think here?
> That it can be an untyped variable like for fillchar?

No.

>
>
>> In ObjFPC mode it is shortstring, unless set to ansistring as well using 
> {$H+}.
>> So, in both cases 'string' = a single byte string, system codepage.
>> There is - in the released FPC - no overloaded version with widestrings.
>> Hence there is no need to document encoding: it is implicit.
>
> I don't understand what you are trying to say.
> When I (as a programmer) want to use i.e. FindFirst I have to hand over a  path.
> I now want to declare a string type for this.
> Which one should I use?

String.

Which means either AnsiString or ShortString. 
So, in both cases a single byte string, system codepage.

> Could it be whatever I want?
> I can't find out with the documentation.

I admit that the bug in fpdoc has not exactly helped. I have since fixed that,
and in version 2.6.4, this problem should be fixed.

But, assuming that it says 'string', that gives you enough information.

Michael.


More information about the Lazarus mailing list