I.T. Discussion Community!
-Collapse +Expand
To/From Code
-Collapse +Expand Members-Only
Sign in to see member-only pages.
   ► KBTo/From GuidesLanguage Details  Print This     

Inlining (Cross Ref > Language Details)

Inlining

General Info: Inline Routines

Instead of calling a routine, you move the code from the routine itself and expand it in place of the call. In addition to manual inlining, some languages support automatic inlining where the compiler or some other pre-compiler decides when to inline a code routine. Also, some languages allow for developer defined inlining where the developer can suggest and/or force the inlining of a code routine. Inlining can optimize your code for speed by saving a call and return, and parameter management.

Languages Focus

Does it support inlining? If so, does it support developer defined inlining? Does it support automatic inlining? Both?

Access VBA:   Not Supported
ASP Classic:   Not Supported
C#:   Automatic

In C#, inlining is automatically done for you by the JIT compiler for all languages and in general leads to faster code for all programmers whether they are aware of inlining or not.

More Info / Comment
C++:   inline

In both Visual C++ and C++Builder, use the inline (standard C++) or __inline (standard C and C++) keywords to suggest to the compiler to inline a routine.

Microsoft also offers __forceinline and _inline, Microsoft specific specifiers where __forceinline is a stronger suggestion but still does not always mean the routine will be inlined as well as _inline for backward compatibility.

Syntax Example:
inline int add(int p1, int p2) {
int result;
 
  result = p1 + p2;
return result;
};
C++/CLI:   Automatic

In C++/CLI, inlining is automatically done for you by the JIT compiler for all languages and in general leads to faster code for all programmers whether they are aware of inlining or not.

More Info / Comment
Corel Paradox:   Not Supported
Delphi:   Inline

Delphi introduced developer defined function and procedure inlining with Delphi 2005. Use the inline keyword to tell the compiler to try to inline a routine (a compiler hint). Since Delphi will only try to inline the routine, make sure you test for speed because inlining a routine can lead to slower code under some circumstances.

Syntax Example:  
function Add(a, b: Integer): Integer; inline;
begin
end;
Delphi Prism:   Automatic

In Prism, inlining is automatically done for you by the JIT compiler for all languages and in general leads to faster code for all programmers whether they are aware of inlining or not.

More Info / Comment  
Java:   Automatic

The Java compiler automatically inlines when it determines  a benefit. The use of final methods is considered a compiler hint to tell the compiler to inline the method if beneficial.

More Info / Comment
JavaScript:   Not Supported
VB Classic:   Not Supported
VB.Net:   Automatic

In VB.Net, inlining is automatically done for you by the JIT compiler for all languages and in general leads to faster code for all programmers whether they are aware of inlining or not.

More Info / Comment  




Follow PrestwoodBoards on: 


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech