[fpc-pascal] Is this a reference counting bug?

Jonas Maebe jonas.maebe at elis.ugent.be
Sun May 2 14:05:46 CEST 2010


On 02 May 2010, at 13:46, Bihar Anwar wrote:

> On May 2, 2010 4:24:37 PM, Jonas Maebe wrote:
> 
> 
>> The reference counting logic is considered to be an opaque implementation detail (whose implementation can change at any time). It is undocumented by design.
> 
> In fact, it was already documented in detail in FPC Language Reference Guide: 3.2.4 Ansistrings; 3.3.1 Arrays: Dynamic Array; 7.6 Reference counting.

And the last one explicitly states "No assumptions should be made about the number of temporary variables or the time when they are finalized".

> Moreover, I've seen many Delphi code snippets out there (e.g. http://www.cs.wisc.edu/~rkennedy/array-delete) rely on reference counting behaviour.

I know, we've had bug reports about that in the past. Such code is simply broken. See e.g. http://bugs.freepascal.org/view.php?id=15526 and http://bugs.freepascal.org/view.php?id=9472


Jonas


More information about the fpc-pascal mailing list