Am 18.05.2016 10:06 schrieb "LacaK" <la...@zoznam.sk>: > > 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;
Yes. Inline needs to be declared at the declaration however and not the implementation and any function or method that uses it (in the same unit) needs to come afterwards if you want it to be inlined (for other units that doesn't matter as long as you don't have circular dependencies, cause then things get messy). On addition to that "inline" is only a hint for the compiler, so there might be cases when the compiler decides not to inline. Regards, Sven
_______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal