[fpc-devel] 019605: Safety check for "const s: string" (similar to Range or Overflow checks)
florian at freepascal.org
Thu Jun 23 22:44:12 CEST 2011
Am 23.06.2011 22:31, schrieb Martin:
> This is about finding screwups of the refcount. The data modification
> detection of strings is a side effect only.
Why is a "screwup" of the ref. count a problem? It is only a problem if
it gets 0 and the string is disposed?
> Anyway, I repeat. I do not try to detect, if the string content was
> changed => that is a side effect
> I try to catch issues with the refcount.
> They do not happen, if the string is part of a const param record
tr = record
s : string;
r : tr;
procedure Foo(const r : tr);
// r.s is invalid now ...
... hurts as well because r is passed by value because it is small.
More information about the fpc-devel