[fpc-devel] 0026080: Access by index to dynamic array may be failed

Michael Van Canneyt michael at freepascal.org
Mon Apr 28 09:24:15 CEST 2014



On Mon, 28 Apr 2014, Martin Frb wrote:

> http://bugs.freepascal.org/view.php?id=26080
>
> Reading this bug, I came to an interesting question. (Purely out of academic 
> interest / not really interested in the final decision to the bug)
>
> My understanding:
> A property guarantees that the accessor can be changed between "direct field 
> access" and "getter/setter method".
> Code using a property should not be affected by such a change to property,.
>
> To which extend is that statement correct?
>
> Certainly, there is a gurantee that you can change a field property to a 
> getter propert, and it will still compile (that is why "inc(Foo.PropBar)" 
> does no longer compile)
>
> Is there a guarantee, that if that getter return the same value, as the 
> previous field access, that the behaviour of the code using the property will 
> be kept exactly the same? (at all levels of code optimization / with the 
> exception to cpu cycles used)?

No. How can this be guaranteed ? 
One is a move from one memory location to another, the other is a function call, with all that implies.


Michael.



More information about the fpc-devel mailing list