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

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

Expert in Software Engineer firms Exp. 7 year with MCA Degree Holding

Inline function defination: An inline function is one for which the compiler copies the code from the function definition directly into the code of the calling function rather than creating a separate set of instructions in memory. Instead of transferring control to and from the function code segment,...
read more
Inline function defination: An inline function is one for which the compiler copies the code from the function definition directly into the code of the calling function rather than creating a separate set of instructions in memory. Instead of transferring control to and from the function code segment, a modified copy of the function body may be substituted directly for the function call. In this way, the performance overhead of a function call is avoided. The use of the inline specifier does not change the meaning of the function. However, the inline expansion of a function may not preserve the order of evaluation of the actual arguments. Inline expansion also does not change the linkage of a function: the linkage is external by default. In C, any function with internal linkage can be inlined, but a function with external linkage is subject to restriction. The restrictions are as follows: If the inline keyword is used in the function declaration, then the function definition must appear in the same translation unit. An inline definition of a function is one in which all of the file-scope declarations for it in the same translation unit include the inline specifier without extern. An inline definition does not provide an external definition for the function: an external definition may appear in another translation unit. The inline definition serves as an alternative to the external definition when called from within the same translation unit. The C99 Standard does not prescribe whether the inline or external definition is used. read less
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

Tutor taking Computer subjects Classes

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

IT Professional Trainer with 15 years of experience in IT Industry

Can you explain what do you want to know exactly?
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

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

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

View 9 more Answers

Related Questions

Which one is the best php training institute in Kolkata, I would like to join that, please help.
Docckolkata is Training Institute, building the bright careers of the students & docc software solution is a software design-development company under DOCC Group. You can contact us.
Sourav
What is a class?
Class is User defined data type, its contain data members and member function
Thinagaran
0 0
7
What would be the probable salary I would get as a python faculty?
It depends on training institute. Depending on institute you will be getting around 10 - 50 K.
BHARATH
0 0
8
hello sir my name is suryateja i am studying in diploma in computer science and engineering my college complect in c language subject i practice with in simple programs my write to won programs how it you?
Hi Syateja, if I understand your questions correctly let me answer. Best thing to learn and progress is to practice writing programs, initially small programs then gradually can write complex program....
Suryateja
In which program we use character constants?
For the name of months, animal, colors we do use it.
Mona

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

Ask a Question

Related Lessons

Python Overview
Python is a high-level, interpreted, interactive and object-oriented scripting language. Python was developed by Gudo vanRossum in the late eighties and early nineties at the National Research Institute...

Inversion of Control
Problem You have classes that have dependencies on services or components whose concrete type is specified at design time. In this example, ClassA has dependencies on ServiceA and ServiceB. Figure 1 illustrates...

The Zen of Python
Writing programs that actually do what they are supposed to do is just one component of being a good python programmer. It's also important to write clean code that is easily understood, even weeks after...

Try to clear up the basics, if basics are clear then you can go ahead with any difficult problem
Hey guys, To all the students i just want to convey that just clear up your basics so that they can help you solve anyu problem and you would achieve a great success. Regards, Ishani Chakraborty

Python Puzzle: Find The Checksum To Ensure Flawless Data Transfer
Find below the puzzle: sampleInput='''5195 753 2468''' The first item's(5195) largest and smallest values are 9 and 1, and their difference is 8. The second item's(753) largest and smallest values...

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