This is by design.

----- Original Message ----- From: mariano podesta
To: fpc-devel@lists.freepascal.org
Sent: Saturday, January 21, 2006 1:56 AM
Subject: [fpc-devel] interface vs optimizer


hi people,
there is a problem with functions returning interfaces:
if nobody stores the result, the object decrements one reference despite turn off optimizations.

sample:

function getobj: IUnknown;
begin
 Result := TInterfacedObject.Create;
end;

procedure test;
begin
 getobj;
 // here result of getobj has died :(
end;

es there a solution or workaround?

thanks,
marianop




_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to