On Fri, 2 Jun 2006, Alexandre Leclerc wrote:

> I just saw the 'inline' reserved work... It's weird, I code in Delphi
> since 1997 and I never got in toutch with that. This is a discovery
> for me! :)
>
> So if I declare:
> function Max(const a, b: Integer): Integer; inline;
> begin
>   if a > b then
>     Result := a
>   else
>     Result := b;
> end;
>
> Does that mean that the actual code of the function will be inserted
> inline where it has been called; so not making a call on the stack,
> but rather insert the code?
>
> procedure CallingProc;
> begin
>   Max(1, 2);
> end;
>
> Will actually give the "following" once compiled:
>
> procedure CallingProc;
> begin
>   if a > b then
>     Result := a
>   else
>     Result := b;
> end;

Yes, that is the idea.

Michael.

_________________________________________________________________
     To unsubscribe: mail [EMAIL PROTECTED] with
                "unsubscribe" as the Subject
   archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to