View Issue Details

IDProjectCategoryView StatusLast Update
0031428FPCDocumentationpublic2017-02-23 07:10
ReporterLacaKAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.0.0Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0031428: Add to SetLength documentation, that it forces also refcount=1
Descriptionhttp://www.freepascal.org/docs-html/rtl/system/setlength.html

Add info, that calling SetLength on string or dynamic array makes this string or dynamic array unique, iow reference count is 1.

Mentioned for example here: http://wiki.freepascal.org/Dynamic_array as
"... using SetLength on such arrays does create a copy! So if 2 dynamic array variables point to the same array (one has been assigned to the other) they do not do so after using SetLength on one (or both) of them. After the SetLength() call the two variables are distinct arrays whose elements are independent from each other."
TagsNo tags attached.
Fixed in Revision1394
FPCOldBugId0
FPCTarget
Attached Files

Activities

Bart Broersma

2017-02-21 16:04

reporter   ~0098356

Isn't that just a logical consequence of the "copy on write" principle?

LacaK

2017-02-21 18:16

developer   ~0098357

IMO it is not clear, particularly if you SetLength to same size

Michael Van Canneyt

2017-02-22 19:56

administrator   ~0098377

Documented as suggested.

Issue History

Date Modified Username Field Change
2017-02-21 12:11 LacaK New Issue
2017-02-21 12:11 LacaK Status new => assigned
2017-02-21 12:11 LacaK Assigned To => Michael Van Canneyt
2017-02-21 16:04 Bart Broersma Note Added: 0098356
2017-02-21 18:16 LacaK Note Added: 0098357
2017-02-22 19:56 Michael Van Canneyt Fixed in Revision => 1394
2017-02-22 19:56 Michael Van Canneyt Note Added: 0098377
2017-02-22 19:56 Michael Van Canneyt Status assigned => resolved
2017-02-22 19:56 Michael Van Canneyt Fixed in Version => 3.1.1
2017-02-22 19:56 Michael Van Canneyt Resolution open => fixed
2017-02-22 19:56 Michael Van Canneyt Target Version => 3.2.0
2017-02-23 07:10 LacaK Status resolved => closed