IT SOLUTIONS
Your full service technology partner! 
-Collapse +Expand
Coder
Search Coder Group:

Advanced
-Collapse +Expand Coder Study Test
PRESTWOODCERTIFIED
-Collapse +Expand Coder Store
PRESTWOODSTORE

Prestwood eMagazine

October Edition
Subscribe now! It's Free!
Enter your email:

   ► KBRole-Based T...Coding & OOGeneral Codi...   Print This     
  From the June 2010 Issue of Prestwood eMag
 
Coder General Coding Concepts:
Inline Routines
 
Posted 15 years ago on 2/4/2009
Take Away:

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.

Coder Definition Flashcard:
 A flashcard from our Coder Flashcards Library
 A definition from our Coder Definitions Page

KB101858

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.


Inlining and .Net

In .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. Developer defined inlining of methods is not supported.

Inlining and C++

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.

Inlining and Delphi

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

Inlining and Java

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. 

Inlined Foreign Code (Embedded Code)

The term inline is also used when one language is embedded (inlined) within another language. For example, when JavaScript code is embedded in HTML, or a C function into Perl, etc.

More Info

Code:  C# Inlining (Automatic)
Code:  C++ Inlining (inline)
Code:  C++/CLI Inlining (Automatic)
Code:  Delphi Inlining (Inline)
Code:  Delphi Prism Inlining (Automatic)
Code:  Java Inlining (Automatic)
Code:  VB.Net Inlining (Automatic)

Comments

0 Comments.
Share a thought or comment...
 
Write a Comment...
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P161A1
Enter key:
Definition Contributed By Mike Prestwood:

Mike Prestwood is a drummer, an author, and creator of the PrestwoodBoards online community. He is the President & CEO of Prestwood IT Solutions. Prestwood IT provides Coding, Website, and Computer Tech services. Mike has authored 6 computer books and over 1,200 articles. As a drummer, he maintains play-drums.com and has authored 3 drum books. If you have a project you wish to discuss with Mike, you can send him a private message through his PrestwoodBoards home page or call him 9AM to 4PM PST at 916-726-5675 x205.

Visit Profile

 KB Article #101858 Counter
15410
Since 2/4/2009
Sales Website: www.prestwood.com Or visit our legacy sales site: 
legacy.prestwood.com


©1995-2024 Prestwood IT Solutions.   [Security & Privacy]