Factbites
 Where results make sense
About us   |   Why use us?   |   Reviews   |   PR   |   Contact us  

Topic: Inline function


Related Topics

In the News (Fri 11 Dec 09)

  
  Inline Functions In C
The point of making a function "inline" is to hint to the compiler that it is worth making some form of extra effort to call the function faster than it would otherwise - generally by substituting the code of the function into its caller.
A sensible approach would be to put the "static inline" functions in either a header file if they are to be widely used or just in the source files that use them if they are only ever used from one file.
Use "extern inline" in a common header and provide a definition in a.c file somewhere, perhaps using macros to ensure that the same code is used in each case.
www.greenend.org.uk /rjk/2003/03/inline.html   (1321 words)

  
 [No title]
This is achieved by requiring that one and only one of the translation units containing the definition of an inline function be specified as the one that provides an external definition for the function.
If a function is declared with an inline function specifier, then it shall also be defined in the same translation unit.
If all of the file scope declarations for a function in a translation unit include the inline function specifier, then the definition in that translation unit is an inline definition.
plg.uwaterloo.ca /~cforall/C9X/n709.txt   (606 words)

  
 C++ Compile and Run-Time Performance
The general advice is to use inline functions when the inlined function results in fewer instructions than the call to the function, or when the application performs significantly faster with the function inline.
Apparently simple function bodies may be complicated because of calls to other inline functions within the body, or because of implicit constructor and destructor calls (as often occurs in constructors and destructors for derived classes).
Function efficiency is the core of good run-time performance, and C++ functions often have subtle inefficiencies because the language often hides significant work behind very terse syntax.
developers.sun.com /prodtech/cc/articles/CC_perf/content.html   (4921 words)

  
 CLHS: Declaration INLINE, NOTINLINE
inline specifies that it is desirable for the compiler to produce inline calls to the functions named by function-names; that is, the code for a specified function-name should be integrated into the calling routine, appearing ``in line'' in place of a procedure call.
If one of the functions mentioned has a lexically apparent local definition (as made by flet or labels), then the declaration applies to that local definition and not to the global function definition.
inline and notinline declarations of functions that appear before the body of a flet or labels form that defines that function are bound declarations.
clhs.lisp.se /Body/d_inline.htm   (446 words)

  
 Inlining C/C++ functions
While inline is not part of the original C standard most vendors tools allow you to use this in C code as well.
The C++ standard requires an inline function to be identically defined in each "translation unit" in which it is used, so it is not possible to link to an inline function in another file.
Unless a function is declared as 'static' (or __inline), the compiler has to retain the out-of-line version of it in the object file in case it might be called from some other module.
www.arm.com /support/faqdev/1220.html   (1224 words)

  
 Douglas Walls' Weblog : Weblog
Either a function defined with the inline function specifier is inlined at a reference or a call is made to the actual function.
There are two types of extern inline functions, an inline definition which never provides an extern (global) definition of the function and an extern inline function which always provide a global definition of the function.
So, for an inline definition, the programmer is required to supply an extern definition of the function in another translation-unit for references to the function that are not inlined.
blogs.sun.com /dew/entry/c99_inline_function   (1095 words)

  
 PRB: Unresolved Externals for Inline Functions
The function is declared in a header (.H) file, defined as an inline function in one source (.CPP) file, and called from a second source (.CPP) file.
Inline functions are not visible outside of the source file where they are defined.
Force a function version of the inline function to be created in the module that it is defined in.
support.microsoft.com /kb/123768/EN-US   (475 words)

  
 Cprogramming.com Tutorial: Function Tricks
Inline functions are not very important, but it is good to understand them.
Once you define an inline function, using the 'inline' keyword, whenever you call that function the compiler will replace the function call with the actual code from the function.
To go through your program and replace a function you have used 100 times with the code from the function would be time consuming not too bright.
www.cprogramming.com /tutorial/lesson13.html   (354 words)

  
 Info Node: (gcc.info)Inline
Inline functions are included in the ISO C99 standard, but there are currently substantial differences between what GCC implements and what the ISO C99 standard requires.
When an inline function is not `static', then the compiler must assume that there may be calls from other source files; since a global symbol can be defined only once in any program, the function must not be defined in the other source files, so the calls therein cannot be integrated.
The way to use it is to put a function definition in a header file with these keywords, and put another copy of the definition (lacking `inline' and `extern') in a library file.
www.mcs.vuw.ac.nz /cgi-bin/info2www?(gcc)Inline   (804 words)

  
 LWN: The cost of inline functions
In many cases, inline expansion of functions is necessary; some of these functions employ various sorts of assembly language trickery that must be part of the calling function.
The problem with inline functions is that they replicate the function body every time they are called.
An inline function may seem like it should be faster, but that is not necessarily the case.
lwn.net /Articles/82495   (1047 words)

  
 PGI Workstation User's Guide - 4 Function Inlining
Function inlining replaces a call to a function or a subroutine with the body of the function or subroutine.
If you also specify a size or function name all functions in the inline library meeting the selection criteria are selected for inline expansion at points in the source text where they are called.
An inline library is implemented as a directory with each inline function in the library stored as a file using an encoded form of the inlinable function.
www.tacc.utexas.edu /services/userguides/pgi/pgiws_ug/pgi32u05.htm   (1560 words)

  
 CLHS: Declaration INLINE, NOTINLINE
inline specifies that it is desirable for the compiler to produce inline calls to the functions named by function-names; that is, the code for a specified function-name should be integrated into the calling routine, appearing ``in line'' in place of a procedure call.
If one of the functions mentioned has a lexically apparent local definition (as made by flet or labels), then the declaration applies to that local definition and not to the global function definition.
inline and notinline declarations of functions that appear before the body of a flet or labels form that defines that function are bound declarations.
www.lispworks.com /documentation/HyperSpec/Body/d_inline.htm   (446 words)

  
 9: Inline Functions
When you use the function, the compiler checks to ensure the call is correct and the return value is being used correctly, and then substitutes the function body for the function call, thus eliminating the overhead.
But inlining a big function will cause that code to be duplicated everywhere the function is called, producing code bloat that may mitigate the speed benefit (the only reliable course of action is to experiment to discover the effects of inlining on your program with your compiler).
Inline functions are convenient here because they allow everything to be placed in a header file, which simplifies the process of using the package.
web.mit.edu /merolish/ticpp/Chapter09.html   (5886 words)

  
 GCC-Inline-Assembly-HOWTO
We can instruct the compiler to insert the code of a function into the code of its callers, to the point where actually the call is to be made.
Inline assembly is important primarily because of its ability to operate and make its output visible on C variables.
Notice that the function is declared as a macro.
www.ibiblio.org /gferg/ldp/GCC-Inline-Assembly-HOWTO.html   (3977 words)

  
 C programming language
One of the most important functions of a programming language is to provide facilities for managing memory and the objects that are stored in memory.
function is special in C programs, as it is the function that is first run when the program starts (for hosted implementations of C, and leaving aside "housekeeping" code).
The curly brackets delimit the extent of the function.
www.brainyencyclopedia.com /encyclopedia/c/c_/c_programming_language.html   (3499 words)

  
 Optimization : The __inline Keyword for Inline Functions
An inline function is a function for which the compiler replaces a call to the function with the code for the function itself.
Since the call to an inline function is replaced with the function itself, the overhead of building a parameter list and calling the function is eliminated in the calling function.
Since there is no function call, the overhead associated with entering the function and returning to the caller is eliminated in the called function.
support.sas.com /documentation/onlinedoc/sasc/doc750/html/clug/zcoptinl.htm   (2533 words)

  
 [No title]   (Site not responding. Last check: )
The whole idea behind an inline function is to replace each call of that function with its code body, and it doesn't take a PhD in statistics to see that this is likely to increase the overall size of your object code.
On the other hand, if an inline function body is very short, the code generated for the function body may actually be smaller than the code generated for a function call.
Most compilers treat an inline function that they aren't inlining as if the function had been declared static - that is, local to the file currently being compiled.
cpptips.hyperformix.com /cpptips/inlining   (416 words)

  
 An Inline Function is As Fast As a Macro   (Site not responding. Last check: )
When a function is both inline and static, if all calls to the function are integrated into the caller, and the function's address is never used, then the function's own assembler code is never referenced.
When an inline function is not static, then the compiler must assume that there may be calls from other source files; since a global symbol can be defined only once in any program, the function must not be defined in the other source files, so the calls therein cannot be integrated.
The way to use it is to put a function definition in a header file with these keywords, and put another copy of the definition (lacking inline and extern) in a library file.
lidn.sourceforge.net /books/gcc-3.2/book/Inline.html   (735 words)

  
 What is an inline function?   (Site not responding. Last check: )
When we make a call to an inline function, the compiler simply replaces the call by a compiled copy of the function body (with some appropriate renaming of variables to avoid conflicts).
Inline functions can reduce the run time of a program by removing unnecessary function calls, but, used unwisely, may also cause the size of the program to explode.
In particular, note that inlining of functions with recursive calls is impossible, as is inlining of most virtual function calls.
www.cs.odu.edu /~zeil/cs361/Lectures-f02/00faq/faq/inline.html   (605 words)

  
 Nabble - inline
A function declared with an inline function specifier is an inline
function suggests that calls to the function be as fast as possible.
In C for references to "inline" functions, because of ISO C 6.7.4.(6).
www.nabble.com /inline-p7218509.html   (1297 words)

  
 ExternVsStaticInline - CE Linux Public   (Site not responding. Last check: )
There are functions in the kernel which do not work properly when they are expressed as functions (with function prolog and epilog code) rather than as inline code.
However, if function pointers are takend for static inline functions, then they won't match and code which compares function addresses will behave differently.
By setting a function as 'extern inline', and then NOT providing as associated extern non-inline function to back it up, if the compiler fails to inline the function a linker error will be generated.
www.celinuxforum.org /CelfPubWiki/ExternVsStaticInline   (390 words)

  
 Inline   (Site not responding. Last check: )
This makes execution faster by eliminating the function-call overhead; in addition, if any of the actual argument values are constant, their known values may permit simplifications at compile time so that not all of the inline function's code needs to be included.
The function must also be compiled as usual if the program refers to its address, because that can't be inlined.
inline function is always compiled on its own in the usual fashion.
www.emerson.emory.edu /services/gcc/html/Inline.html   (503 words)

  
 Inline User-defined Functions
Inline user-defined functions are a subset of user-defined functions that return a table data type.
Inline user-defined functions can be used to support parameters in the search conditions specified in the WHERE clause.
Inline functions can also be used to increase the power of indexed views.
msdn.microsoft.com /en-us/library/ms189294.aspx   (519 words)

  
 Question about inline function modifier - C++ Forums
An inline function is a function that is expanded inline at the point at which it is invoked, instead of actually being called.
For an inline function, the code is instead placed at the places it is called instead of generating a child function.
So if you call the inline function from a hundred different places, the code that would have been compiled from the function had it not been inline is instead placed in the hundred different calling areas.
www.cplusplus.com /forum/beginner/2310   (612 words)

  
 C++ Inline Functions
Inline functions are functions where the call is made to inline functions.
If the function is short, the programmer may wish to place the code of the function in the calling program in order for it to be executed.
The alternative approach is to allow inline functions to achieve the same purpose, with the concept of functions.
www.exforsys.com /tutorials/c-plus-plus/inline-functions.html   (685 words)

  
 Function Inline Expansion
Function inline expansion eliminates procedure-call overhead and allows general optimization methods to apply across the expanded code.
Function inlining has advantages over macros in that arguments are evaluated only once, parentheses need not be overused to avoid problems with precedence, and the actual expansion can be controlled from the command line.
The address of an inline function can be taken and expressions that imply the conversion of the inlined function name to an address are allowed.
h30097.www3.hp.com /docs/base_doc/DOCUMENTATION/V40F_HTML/AQTLTBTE/DOCU_143.HTM   (229 words)

  
 Javascript Closures
function and passes a reference to a function object as the first argument and the millisecond interval as the second, but a reference to a function object cannot provide parameters for the scheduled execution of that function.
If one function was dependent on one (or several) other functions, but those other functions were not expected to be directly employed by any other code, then the same technique could be used to group those functions with the one that was to be publicly exposed.
As the inner function in the first version is not being used to exploit the closures produced by its use, it would be more efficient not to use an inner function, and thus not repeat the process of creating many essentially identical function objects.
jibbering.com /faq/faq_notes/closures.html   (6630 words)

Try your search on: Qwika (all wikis)

Factbites
  About us   |   Why use us?   |   Reviews   |   Press   |   Contact us  
Copyright © 2005-2007 www.factbites.com Usage implies agreement with terms.