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

What is #line used for?
# is a preprocessor directive. so it is used in the c program by two way. 1. such as #include stdio.h In this line to read all the library function of stdio.h before processing the program. 2. # define...
Pradeep
Is Ruby is a Scripting Language or Compiled Language?
Ruby is an interpreted language. A ruby interpreter is required to run the code. As its an interpreted programming language, the errors will be thrown only when it is encountered by the interpreter.
Aavinash
0 0
6

is there an best online exam simulator for PCAP 31-02 python exam ?

yes, this will work Python exam in cisco net grade, it 's free and help in practice and if you clear this exam, you will get 50% off PCAP 31-02 exam coupon on your registered email id.
Rajgun
0 0
5
Is there any online Python coaching classes available?
Yes it is. You can contact me and visit my profile for Online classes
Abhishek
0 0
5

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

Ask a Question

Related Lessons

Build an interactive Dictionary using Python 3.x
I have downloaded a 5MB data base consisting of words and their meanings in a json file . I want to write a python progrsm which will ask the user to enter a word and then the program will search through...
B

Biswanath Banerjee

0 0
0

SQL Tips (4 to 6)
SQL tips 4:Avoid INDEX, unless you need to retrieve information quickly. Index will slower insert and update data query.The another way is using sub querySelect MAX(salary)FROM employeeWHERE salary IN(Select...

Swapping Two Numbers
Q. Swap two numbers using the following function. Complete the function. You won't be allowed to use a temporary variable to swap the two numbers. void swap ( ... ) { /* Swap code goes here */ } ...

Advantages of C++ Language
Advantages of C++ - C++ is a profoundly convenient dialect and is frequently the dialect of decision for multi-gadget, multi-stage application advancement. - C++ is a protest situated programming dialect...

Palindrome Number : Java Function
An easier way to find out whether a number is a Palindrome number or not. Eg. 121, 88, 12321 etc public boolean isPalindrome ( int n ) { int rev = 0, r; for( i = n; i > 0; i /= 10 ) { r...

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