Alex Rivera | Logout

what is use of inline keyword in delphi

Asked 2009-07-22T12:24:03.793
18

can any one please say what is use of inline keyword in delphi

Edit
Report

2 Answers

13

It tells the compiler to generate code for the inline; routine on the place where it is called, instead of jumping to the routine and back.

For procedures that translate to very short assembler, this can be a benefit to performance, because the actual code is relatively short compared to the parameter preparation, the actual calling and the procedure prologue/epilogue.

If the procedure is too long, it can be a brake on performance though, and blow up your code gigantically. The "Auto" setting should make this decision for you, but in specific cases, you can locally set {$inline to on to force it. (e.g. for C macros translated to pascal functions, like the zlib functions to work with bitstreams )

answered 2009-07-22T12:30:57.320
12

Others have answered what inline does, but I just wanted to point out that there is a Compiler option to set inline on, off, or auto. Check out "Calling Procedures and Functions" in the D2009 docs for a very good explanation of the mechanics of inline. Here's the link to the online docs:

Delphi Online Docs for inline

answered 2009-07-22T12:39:46.590

Your Answer