[fpc-pascal] inlining functions

Marc Santhoff M.Santhoff at t-online.de
Thu Oct 19 05:55:20 CEST 2006


Hi,

when using "inline" on a procedure or function, does it completely avoid
the call by copying anything inside the "begin ... end" block to the
right place?

Example:

function anythingFunc(v: integer):real; inline;
begin
	... some calculations ...
end;

function TMyObject.callAnything(v: integer):real;
begin
	result := anythingFunc(v);
end


This will result in two levels of calls (one for the method of TMyObject
and one from inside the method to the global function) without inlining.

I assume with inline on it is only *one* call, which would be a speed
improvement especially when called often.

Can someone confirm I understand this correctly?

TIA,
Marc





More information about the fpc-pascal mailing list