answersLogoWhite

0

In-line functions differ from normal functions by the way they are dealt with by the compiler.

Normally, a function (or its code, more exactly) is stored once within the executable program. A call to this function then results in putting the parameters onto the stack and jumping to the start address of the function. When the function is finished, the stack is freed from the parameters and the program continues right after the point from where it has jumped to the function.

For an in-line function, its code is stored at any place where it is called. This saves us from the administrative overhead (putting parameters etc. onto the stack and cleaning up at the end) and, thus, reduced computing time. On the other side it enlarges the eecutable.<br>

This leads to some restrictions to inline-functions.

User Avatar

Wiki User

17y ago

What else can I help you with?

Related Questions

What are the disadvantages of inline functions?

The inline functions is an optimization technique that is used by the compilers. The disadvantage of the inline functions is the increased binary size.


What size engine does the 2011 Volkswagen CC have?

The 2011 Volkswagen CC has an inline 4 engine.


What size engine does the 2009 Volkswagen CC have?

The 2009 Volkswagen CC has an inline 4 engine.


What size engine does the 2010 Volkswagen CC have?

The 2010 Volkswagen CC has an inline 4 engine.


What size engine does the 2013 Volkswagen CC have?

The 2013 Volkswagen CC has an inline 4 engine.


What size engine does the 2012 Volkswagen CC have?

The 2012 Volkswagen CC has an inline 4 engine.


What size engine does the 2014 VW CC have?

The 2014 Volkswagen CC has an inline 4 engine.


Is inline function a command?

No, functions (inline or other) aren't commands.


What is the difference between inline and const?

Everything. "inline" refers to functions, "const" refers to variables.


Why inline functions shall not be defined with extern or static storage class?

inline itself should be considered as a storage class


When will you make inline function?

Trivial functions, such as member variable accessors that simply return a member's value, are prime candidates for inline expansion. However trivial non-member functions can also be inline expanded, as can any non-trivial function that is rarely called.Member functions defined in the body of the class declaration are implicitly declared inline. However, whether a function is explicitly declared inline or not, the compiler is free to ignore any inline request, such as when the inline expansion of a non-trivial function would adversely compromise code size, for instance.Note that inline expansion replaces the call to a function with a modified version of the function's body within the calling functions -- just as if you'd duplicated the code yourself, rather than creating a separate function -- which removes the overhead of making a function call.The only way to force a function inline is to manually write the expanded code yourself. But if the code appears in several places, maintenance of the code will be compromised.If there's ever any doubt, declare it inline and let the compiler decide. It's in a far better position to determine if it should be inline expanded or not.


Automatic inline in c plus plus?

The C++ compiler will implicitly (automatically) mark functions for inline expansion whenever you define a function within its own declaration. If functions are declared and defined separately (even in the same file) then they are not implicitly marked for inline expansion. To enable inline expansion for these definitions, you must explicitly mark the definition (not the declaration).