0% found this document useful (0 votes)
32 views9 pages

Inline Functions

The document discusses inline functions and inline assembly in C++. Inline functions are functions whose code is expanded at the point of each function call rather than executing a separate function call. This can improve execution time by eliminating function call overhead for small functions. Inline assembly allows embedding low-level assembly code within a program compiled from a high-level language like C. It has benefits but also limitations such as not being able to contain return statements and potentially increasing executable size.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views9 pages

Inline Functions

The document discusses inline functions and inline assembly in C++. Inline functions are functions whose code is expanded at the point of each function call rather than executing a separate function call. This can improve execution time by eliminating function call overhead for small functions. Inline assembly allows embedding low-level assembly code within a program compiled from a high-level language like C. It has benefits but also limitations such as not being able to contain return statements and potentially increasing executable size.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Presentation

Subject : Advanced Microprocessor

TOPIC:- Inline function and inline assembly


Department =Ec A1
Enrollment. No. =160130111015

Guided by :- Prof. Suhas Patel


INLINE FUNCTION

DEFINITION :

In C++, the functions that are not actually called


rather their code is expanded in line at the point of
each invocation such functions are called inline
functions
WHY IT IS NEEDED?
• Some important points about
inline function

• Inline functions are enhancement feature to


increase the execution time of a program.
• By using it we can eliminate the cost of calls
to small functions.
• Inline keywords sends a request not a
command to the compiler.
Inline assembler
 In computer programming an inline assembler is a
feature of some compilers that allows low level code
written in assembly language to embedded within a
program that has been compiled from a high level
language such as C.

 It is just a set of assembly instructions written as inline


functions.
CONDITIONS AND LIMITATIONS

 Function should not have any return statement.


 Function length should be short.
 It increases the executable size due to code expansion.
 It increases the executable size, which may cause
thrashing in memory.
Simple example :-

Void main ()

C=add(5,3) call

}
Int add (int x, int y) definition

Here the definition is inlined when the function


calls. It is a request so compiler can also ignore
it.

You might also like