[fpc-devel] {$INLINE OFF}

Sven Barth pascaldragon at googlemail.com
Mon Sep 3 17:46:37 CEST 2012


Am 03.09.2012 17:13, schrieb Martin:
> Does this
> 1) prevent functions declared in this unit from being inlined (in this
> or other units)
> 2) functions from other units, that are called in this unit from being
> inlined:
>
> I get 1, but not 2:
>
> program project1;  {$mode objfpc}{$H+}  {$INLINE OFF}
> uses Classes, types;
>
> function MyPoint(X, Y: Integer): TPoint;
> begin
>    Result.x := x;
>    Result.y := y;
> end;
>
> var  a: TPoint;
> begin
>    a := Point(1,1);       // inlined
>    a := MyPoint(1,1); // not inlined
> end.

Note: Your MyPoint will never be inlined as it does not have the 
"inline" modifier.

Regards,
Sven




More information about the fpc-devel mailing list