On 11 Jul 2011, at 02:08, Chad Berchek wrote: > Even if the calling convention does not change, the semantics can, as > currently implemented. Even within a single platform const is ill-defined. > Consider the case of AnsiString. There are three cases as it is currently > implemented: > > 1) Ref count > 1 when passed as const parameter results in strict > pass-by-value semantics > 2) Ref count = 1 and you modify the original instance in-place results in the > value of the parameter changing > 3) Ref count = 1 and you modify the original reference such that the > instance's ref count decreases to zero and it may crash or just give weird > behavior
Case 1) is the same as 2) and 3). Even if the reference count is initially 100, the called routine can overwrite all but one of them first and then either do 2) or 3). Jonas_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel