UrbanPro

Learn Programming Languages from the Best Tutors

  • Affordable fees
  • 1-1 or Group class
  • Flexible Timings
  • Verified Tutors

Search in

What are the restriction in making a inline function?

Asked by Last Modified  

Follow 2
Answer

Please enter your answer

Trainer

Inline function is the optimization technique used by the compilers. One can simply prepend inline keyword to function prototype to make a function inline. Inline function instruct compiler to insert complete body of the function wherever that function got used in code. Advantages :- 1) It does...
read more
Inline function is the optimization technique used by the compilers. One can simply prepend inline keyword to function prototype to make a function inline. Inline function instruct compiler to insert complete body of the function wherever that function got used in code. Advantages :- 1) It does not require function calling overhead. 2) It also save overhead of variables push/pop on the stack, while function calling. 3) It also save overhead of return call from a function. 4) It increases locality of reference by utilizing instruction cache. 5) After in-lining compiler can also apply intraprocedural optmization if specified. This is the most important one, in this way compiler can now focus on dead code elimination, can give more stress on branch prediction, induction variable elimination etc.. Disadvantages :- 1) May increase function size so that it may not fit on the cache, causing lots of cahce miss. 2) After in-lining function if variables number which are going to use register increases than they may create overhead on register variable resource utilization. 3) It may cause compilation overhead as if some body changes code inside inline function than all calling location will also be compiled. 4) If used in header file, it will make your header file size large and may also make it unreadable. 5) If somebody used too many inline function resultant in a larger code size than it may cause thrashing in memory. More and more number of page fault bringing down your program performance. 6) Its not useful for embeded system where large binary size is not preferred at all due to memory size constraints. read less
Comments

Coaching

We put inline keyword in front of a function which requests a compiler to make that function as inline function. Following are the situations where inline functions may not work properly: 1.If we have two or three statements then it works otherwise compiler will ignore inline keyword and will...
read more
We put inline keyword in front of a function which requests a compiler to make that function as inline function. Following are the situations where inline functions may not work properly: 1.If we have two or three statements then it works otherwise compiler will ignore inline keyword and will treat as a normal function. 2.Functions returning values, having a loop, a switch or a go to statement. 3.If the function contains static variables. 4.If inline functions are recursive. read less
Comments

IT Professional Trainer with 15 years of experience in IT Industry

Can you explain what do you want to know exactly?
Comments

Software Professional Trainer with 26+ years of Experience in Software Design and Development

Inline function will very useful if your line of code is very less, it will improve the peformance. If the line of code inside the function is more, then inline will not improve the performance. Before compilation, the inline function call will be replaced with actual of inside the inline functio...
Comments

Artificial intelligence Trainer

Inline function is used when u have just 1-2 or small line of code to be used many times so through inline function we write code inside inline function and call that inline function wherever we require that code for eg if have want c=a+b to be used in more than one place i will create an inline function...
read more
Inline function is used when u have just 1-2 or small line of code to be used many times so through inline function we write code inside inline function and call that inline function wherever we require that code for eg if have want c=a+b to be used in more than one place i will create an inline function inlindemo(int a,int b) { c=a+b; } and wherever that addition code needs to be written i will simply call inlindemo so that my processing time is reduced and it speeds up the execution of coding one greatest disadvantage of inline function is that if code has more number of lines there is no use of creating that code inside inline function because writing large lines of code inside inline function has more overhead involved while calling the inline function rather than writing the large code again and again so basically inline function is used only for small line of codes read less
Comments

Tutor

Inline function is the optimization technique used by the compilers. One can simply prepend inline keyword to function prototype to make a function inline. Inline function instruct compiler to insert complete body of the function wherever that function got used in code. Disadvantages :- 1) May increase...
read more
Inline function is the optimization technique used by the compilers. One can simply prepend inline keyword to function prototype to make a function inline. Inline function instruct compiler to insert complete body of the function wherever that function got used in code. Disadvantages :- 1) May increase function size so that it may not fit on the cache, causing lots of cahce miss. 2) After in-lining function if variables number which are going to use register increases than they may create overhead on register variable resource utilization. 3) It may cause compilation overhead as if some body changes code inside inline function than all calling location will also be compiled. 4) If used in header file, it will make your header file size large and may also make it unreadable. 5) If somebody used too many inline function resultant in a larger code size than it may cause thrashing in memory. More and more number of page fault bringing down your program performance. 6) Its not useful for embeded system where large binary size is not preferred at all due to memory size constraints read less
Comments

Tutor taking Computer subjects Classes

Inline function must be defined above from the point of its call.
Comments

Making a function inline is just a request to compiler to insert complete body of function at all places of function calls. The request may or may not be entertained by the compiler. Compiler makes these decision on the basis of number of function calls and the length of the function.
Comments

MCA | GNIIT and Sangeet bhusan (Tabla)

The basic idea is to make short and simple functions to be in-lined for faster execution. Also the functions defined inside the class are by default inline but still depends on compiler if it has loops, long code, lots of changes in flow of control, return statements then the compiler will not treat...
read more
The basic idea is to make short and simple functions to be in-lined for faster execution. Also the functions defined inside the class are by default inline but still depends on compiler if it has loops, long code, lots of changes in flow of control, return statements then the compiler will not treat it as a inline function. read less
Comments

1) May increase function size so that it may not fit on the cache, causing lots of cahce miss. 2) After in-lining function if variables number which are going to use register increases than they may create overhead on register variable resource utilization. 3) It may cause compilation overhead as if...
read more
1) May increase function size so that it may not fit on the cache, causing lots of cahce miss. 2) After in-lining function if variables number which are going to use register increases than they may create overhead on register variable resource utilization. 3) It may cause compilation overhead as if some body changes code inside inline function than all calling location will also be compiled. 4) If used in header file, it will make your header file size large and may also make it unreadable. 5) If somebody used too many inline function resultant in a larger code size than it may cause thrashing in memory. More and more number of page fault bringing down your program performance. 6) Its not useful for embeded system where large binary size is not preferred at all due to memory size constraints. read less
Comments

View 9 more Answers

Related Questions

What is RDBMS ? Differentiate between DBMS & RDBMS . Give examples of any 2 RDBMS packages .
The key difference is that RDBMS (relational database management system) applications store data in a tabular form, while DBMS applications store data as files.Even Database can store data in tables, but...
Dibyendu
Which are the best books to learn C?
Yashavant Kanetkar
Kratika
What are the toughest topics in C language?
1. pointer 2. dynamic memory allocation 3. File handling
Lokayya
0 0
5

How do apprach to an unknown problem to construct its solution? Especially when do you face any programming challenge.

First approach your teacher or tutor about problem statement and ask for solution to get it solved.. Next practise similar kind of things by using other books or google or youtube help... If you u facing any challenges...
Tanmoy Gupta
0 0
8
Please Tell Me About PHP ?
PHP (recursive acronym for PHP: Hypertext Preprocessor) is a widely-used open source general-purpose scripting language that is especially suited for web development and can be embedded into HTML. It allows...
Indal

Now ask question in any of the 1000+ Categories, and get Answers from Tutors and Trainers on UrbanPro.com

Ask a Question

Related Lessons

Learn Python : Slicing out an email address
We take a small task of slicing out the username and domain name from an email address. We ask the user to type his email address. We take his email address and slice out first his username and then the...
B

Biswanath Banerjee

0 0
0

What is the output of this programming?
#include<stdio.h> main() { printf("%d chennai",+1); }
A

C++ Program-Factorial
//Header files #include<iostream.h>#include<conio.h> //Main function void main(){ int num,i; long factorial=1; //Function for clearing screen clrscr(); cout<< "Enter a number:";...
S

C Program-Error Handling
//Header files #include<stdio.h>#include<conio.h>#include<stdlib.h> //Main function void main(){ int dividend=10; int divisor=0; int quotient; //Function for clearing screen clrscr(); ...
S

Polymorphism In C++
Basically polymorphism represents poly means many and morph means forms that many forms. In which we are passing same message to different objets but every object will work for that message in their own...

Recommended Articles

Almost all of us, inside the pocket, bag or on the table have a mobile phone, out of which 90% of us have a smartphone. The technology is advancing rapidly. When it comes to mobile phones, people today want much more than just making phone calls and playing games on the go. People now want instant access to all their business...

Read full article >

Microsoft Excel is an electronic spreadsheet tool which is commonly used for financial and statistical data processing. It has been developed by Microsoft and forms a major component of the widely used Microsoft Office. From individual users to the top IT companies, Excel is used worldwide. Excel is one of the most important...

Read full article >

Software Development has been one of the most popular career trends since years. The reason behind this is the fact that software are being used almost everywhere today.  In all of our lives, from the morning’s alarm clock to the coffee maker, car, mobile phone, computer, ATM and in almost everything we use in our daily...

Read full article >

Whether it was the Internet Era of 90s or the Big Data Era of today, Information Technology (IT) has given birth to several lucrative career options for many. Though there will not be a “significant" increase in demand for IT professionals in 2014 as compared to 2013, a “steady” demand for IT professionals is rest assured...

Read full article >

Looking for Programming Languages Classes?

Learn from the Best Tutors on UrbanPro

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for Programming Languages Classes?

The best tutors for Programming Languages Classes are on UrbanPro

  • Select the best Tutor
  • Book & Attend a Free Demo
  • Pay and start Learning

Learn Programming Languages with the Best Tutors

The best Tutors for Programming Languages Classes are on UrbanPro

This website uses cookies

We use cookies to improve user experience. Choose what cookies you allow us to use. You can read more about our Cookie Policy in our Privacy Policy

Accept All
Decline All

UrbanPro.com is India's largest network of most trusted tutors and institutes. Over 55 lakh students rely on UrbanPro.com, to fulfill their learning requirements across 1,000+ categories. Using UrbanPro.com, parents, and students can compare multiple Tutors and Institutes and choose the one that best suits their requirements. More than 7.5 lakh verified Tutors and Institutes are helping millions of students every day and growing their tutoring business on UrbanPro.com. Whether you are looking for a tutor to learn mathematics, a German language trainer to brush up your German language skills or an institute to upgrade your IT skills, we have got the best selection of Tutors and Training Institutes for you. Read more