[lazarus] String parameters, ansistrings

SVAA svaa at retemail.es
Sun May 20 14:57:36 EDT 2001


>I think it doesn't matter for lazarus, because lazarus is mainly using
>and ansistring parameters are only a pointer.

If you don't declare as "const" not "var", it copies the string. It doesn't
matter if the internal implementation of ansistring is a pointer, for you it
is a variable, and if you don't declare it a var parameter you expect that
when you modify it inside the rutine the caller value won't be modified, so
it must copy.

I've test it with ansistrings (using H+, and declaring explicit ansistring)
and the results are similar:

with "const" of "var":
     about 1 second
Without "const" nor "var":
     about 17 seconds.

Santiago Amposta
svaa at retemail.es

More information about the Lazarus mailing list