[fpc-devel] interface vs optimizer

Alexey Barkovoy clootie at ixbt.com
Sat Jan 21 00:05:56 CET 2006


This is by design.


----- Original Message ----- 
From: mariano podesta
To: fpc-devel at 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 at lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel 




More information about the fpc-devel mailing list