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  

11 Answers

Learn Programming Languages

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

Hi, I'm BCA graduate, and I have seven years in the general insurance field now I want to change my profile and upgrade my knowledge. Will learning python help me with my growth in my career?
Hi, as far as my knowledge goes first, you should learn data processing tools or programs like MS Excel, Power Bi, or SQL then you should then take a leap into Python, which will make automating your work quite simple.
Supriya
what we can access private data of any class without using member function
There are two ways to access it. 1) Friend functions can access the private data of the class. 2) Typecast the object address to a pointer and then access the individual variables through memory...
Keshav

Is python useful for app development?

Android doesn't support python but you can convert easily python to android app.
Prachi

I am working in a nontechnical field and i want to  switch this job and work in a technical field but I am not able to decide where to start. I want to learn, but what in Python?

I can help you make a blasting entry in technical profile. You can learn Informatica+Oracle and one real time project with me. It should be enough for your future growth.
Raksha
Is learning Python good or bad?
Its depend on your requirement, I mean if you are seeking for good opportunity to move from one Org. to another, or migrating some applications into your project, or your manager are eagerly requesting...
Harish
0 0
7

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

Ask a Question

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