[fpc-pascal] Inline methods
Mark Morgan Lloyd
markMLl.fpc-pascal at telemetry.co.uk
Wed May 18 11:41:05 CEST 2016
LacaK wrote:
> Hi *,
> is it possible inline also methods of objects (not regular procedures) ?
> I have very simple class method, which call I need inline.
> (looking at assembler code it is not inlined; I have looked also in
> documentation, but I do not found article about inline and methods)
>
> Example:
>
> function T2DArray.Data(x, y: integer): PElement; inline;
> begin
> Result := @FArray[x+y*Fx];
> end;
I thought it was, and believe that in the past I've been told that it
was a useful optimisation aid hence in my code I find e.g.
(*
Setters marked "inline" are trivial except for an assertion to check the
parameter range. Most of the associated code will be optimised away if
assertions are ignored by the compiler.
*)
[Sorry, I've got this bad habit of commenting stuff which some people
frown on. But I think that for something like this- i.e. /why/ something
is being done- it's justified.]
--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk
[Opinions above are the author's, not those of his employers or colleagues]
More information about the fpc-pascal
mailing list