[fpc-devel] Need patch for bugs : 0011503 / 0009472
Florian Klaempfl
florian at freepascal.org
Thu Jun 19 15:59:24 CEST 2008
Boian Mitov schrieb:
> Hi Florian,
>
> Thank you!
> This is false! In Delphi the interface is released immediately.
No.
> Before
> you make such statement I advise you to verify the Delphi behavior.
I did so because I discussed this behaviour several times before. Just
compare the output of and explain me your theory about it:
type
tclass1 = class(TInterfacedObject)
destructor destroy;override;
end;
destructor tclass1.destroy;
begin
writeln('destroyed');
inherited;
end;
function f : IInterface;
begin
f:=tclass1.create;
end;
var
i : IInterface;
procedure p;
begin
i:=f;
i:=nil;
writeln('exiting');
end;
begin
p;
writeln('back');
end.
and
type
tclass1 = class(TInterfacedObject)
destructor destroy;override;
end;
destructor tclass1.destroy;
begin
writeln('destroyed');
inherited;
end;
function f : IInterface;
begin
f:=tclass1.create;
end;
procedure p;
var
i : IInterface;
begin
i:=f;
i:=nil;
writeln('exiting');
end;
begin
p;
writeln('back');
end.
> I
> can ensure you that D5, 6, 7, 2005, 2006, 2007 as well as BCB 5, 6,
> 2006, and 2007 will release the object before the end of the block.
No.
> FPC
> behaves completely different way. As the best of my understanding they
> have implemented the TMP the same way as it is described in the ANSI C++
> standard, but if you wish I can ask them. I will be meeting the CodeGear
> guys next week, and I can chat with them on that.
>
> The information I provided was for the ANSI standard as the guy was
> interested how they have defined it ;-) .
>
> With best regards,
> Boian Mitov
>
> --------------------------------------------------------------------
> Mitov Software
> http://www.mitov.com
> --------------------------------------------------------------------
>
>
> ----- Original Message ----- From: "Florian Klaempfl"
> <florian at freepascal.org>
> To: "FPC developers' list" <fpc-devel at lists.freepascal.org>
> Sent: Thursday, June 19, 2008 6:42 AM
> Subject: Re: [fpc-devel] Need patch for bugs : 0011503 / 0009472
>
>
>> Boian Mitov schrieb:
>>> Hi Marco,
>>>
>>> You are wrong. They mean expression not block!
>>
>> This path of the discussion is useless. As soon as you make WriteLock
>> a global/static var, delphi behaves the same as fpc: it creates a
>> temp. ref. which is only cleaned at procedure exit.
>> _______________________________________________
>> fpc-devel maillist - fpc-devel at lists.freepascal.org
>> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>
> _______________________________________________
> fpc-devel maillist - fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel
>
More information about the fpc-devel
mailing list