[fpc-devel] mising ansi string ref increase
Sergei Gorelkin
sergei_gorelkin at mail.ru
Thu Jul 22 10:57:44 CEST 2010
Martin пишет:
>
> Anyone any idea, if there s any code that could cause such an
> "optimization" ?
>
This is by design. 'const' modifier on ansistring and other 'managed' type arguments instucts the
compiler to omit refcount changes, yielding a faster code. At the same time it prohibits direct
modification to the argument, but nothing can be done if you modify another location that aliases
the argument.
If you need proper refcounting, you should pass the argument by value (i.e. without 'const' modifier).
Regards,
Sergei
More information about the fpc-devel
mailing list