[fpc-devel] Need patch for bugs : 0011503 / 0009472
jonas.maebe at elis.ugent.be
Thu Jun 19 14:13:04 CEST 2008
On 19 Jun 2008, at 13:53, Boian Mitov wrote:
> This functionality works in all versions of Delphi 5-2007. We
> support them all, and we have done so for years. We have no problems
> to compile with such optimizations turned off.
One final time: please read the comments to http://bugs.freepascal.org/view.php?id=9472
It's not an optimisation which needs to be turned off. On the
contrary, you are depending on a particular optimisation to be
performed (namely skipping the use of temporary function results when
assigning the result of a function returning an interface to certain
classes of local variables). The effects of this behaviour can also be
emulated by clearing all temps immediately after their use, as Michael
indicates, in which case you obviously get slower and much more
bloated code (and make the compiler code itself also more complex).
I repeat: there is absolutely nothing wrong with using a temporary
function result in such situations, and depending on it not being used
is an error in your code. Your program will also break under Delphi
e.g. when you assign the interface result of a nested functions to a
local variable and also access this variable from the nested function.
You also have not explained why it is so crucial that the interfaces
are immediately released.
> We need proper reference counting.
There is proper reference counting: there are no memory leaks. That's
really all that automatic reference counting guarantees.
You may also want to have a look at http://wiki.freepascal.org/Code_Conversion_Guide#Semantical_differences
for a couple more implementation differences between Delphi and FPC.
More information about the fpc-devel