[fpc-pascal] PChar & AnsiString
spir ☣
denis.spir at gmail.com
Tue Jun 1 17:20:43 CEST 2010
On Tue, 1 Jun 2010 14:36:36 +0200
Jonas Maebe <jonas.maebe at elis.ugent.be> wrote:
>
> On 01 Jun 2010, at 14:28, spir ☣ wrote:
>
> > On Tue, 1 Jun 2010 13:05:16 +0200 (CEST)
> > Michael Van Canneyt <michael at freepascal.org> wrote:
> >
> >> This is not correct. Many strings are simply referenced several
> >> times.
> >
> > May I ask in which typical cases?
>
> The most common one is probably assigning a function result to a
> variable or field.
Is there increment of ref count (I think it does +1-1)? If no, passing the ref cannot have any side-effect, so the copy_on_write scheme does not apply -- or rather does not make any change if applied. This is plain reference copy.
The issue is rather for parameter passing, since here the original var survives the call (see Martin's post).
Denis
________________________________
vit esse estrany ☣
spir.wikidot.com
More information about the fpc-pascal
mailing list