[fpc-devel] Does FPC optimize unused parameters ?

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Aug 24 13:04:23 CEST 2012


Martin wrote on Fri, 24 Aug 2012:

> On 08/08/2012 15:37, Jonas Maebe wrote:
>>
>> Martin wrote on Wed, 08 Aug 2012:
>>
>>> Out of curiosity. Is there an optimization like this
>> [removing calculation/load of unused parameters]
>>
>> No.
>
>  Are you sure? It seems the compiler disagrees with you.
>
> I  tested with 2.7.1 (updated yesterday):
>
> function Foo(s:string): string;
> begin
>   Result := s;
>   Form1.Caption := s;
> end;
>
> procedure TForm1.FormCreate(Sender: TObject);
> begin
>   //DebugLn(['abc']);
>   //DebugLn('abc');
>   DebugLn(foo('abc'));
> end;
>
> The assembler for FormCreate (no optimization used). It even omits  
> the call to "Foo"...

How is debugln defined?


Jonas



More information about the fpc-devel mailing list