Sign in Join
Wiki copytemporary

Inline

Deutsch · English

The modifier inline requests the FPC to consider copying the definition of a routine to the call site (“inlining”). The modifier noinline prevents the FPC from ever inlining a routine, even automatically (since SVN revision 41198, as of 2022 only available in Trunk).

use

The use of inline routines is switched off by default. You can enable it with the ‑Si compiler switch or the {$inline on} local compiler directive. The inline directive is placed after a routine’s signature at its defining point. Example:

pascal
function cube(const x: ALUSInt): ALUSInt; inline;
begin
    cube := sqr(x) * x;
end;

implications

Inlining means that a routine’s implementation exists at multiple places in the final executable file. There is no single address the program jumps to, but every time you invoke that routine there is dedicated copy in the source code.

advantages

disadvantages

caveats

application

If you want to optimize for speed, consider trying {$optimization autoInline} first, before manually adding inline hints.

see also


From the Free Pascal wiki, page "Inline", as it stood on 2023-11-08 after a change by Alextpp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 1, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.