UrbanPro
true

Learn C++ Language from the Best Tutors

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

Search in

Macro v/s Inline Function

Darpan Kumar
27/05/2017 0 0

Disadvantages of Macro compared to functions:

  • Works on text substituiton mechanism by the preprocessor unlike normal functions where assembly-language Call and Return are used.
  • Preprocessor macros cannot access class member data and hence they cannot be used as class member functions.
  • Generally confined to functions that can be expressed in a single statement.
  • No type checking is done for macros.

 Inline function:

  • C++ implements macro as inline function.
  • Function definition inside a class definition is automatically inline.
  • Inline function is expanded in place, like a preprocessor macro so that overhead of function call is eliminated.
  • The keyword inline is just a suggestion to the compiler to make the function inline. There are cases when the inilining cannot be performed:
  1. Compiler cannot perform inlining if the function is too complicated.
  2. Compiler cannot perform inlining if the addess of the function is taken implicitly or explicitly. If the compiler must produce an address, then it will allocate storage for the function and use the resulting address.
  3. Compiler does not perform inlining if are static variables used in the function.
  4. Compiler does not perform inlining if there is a recursive function call.
  • Inline functios have internal linkage. The keyword extern has no significance when used with inline functions.
0 Dislike
Follow 0

Please Enter a comment

Submit

Other Lessons for You


Software Development Training In Jaipur
Satyam Web Solution provides website designing &development and software designing &development training in Jaipur for various stream’s students. MCA 6 month Industrial Training/Internship B....

Difference Of Inheritance In C++ And Java
In Java , multiple inheritance is not applicable directly but we can implement the concept by using the interfaces. In c++ and Java, the common types of inheritances are: Single Multi level Hybrid Hierarchical

Necessity of Theory and Practical in Computer Science.
Upon studying a subject both theory and practical are important. Usually many schools concentrate more on theory and the marks not on the practical. Other and opposite kind of people prefer practical...

Why we need to learn Programming languages?
Language is medium for communication. If two parties like to communicate or exchange the thoughts they must know a language. Language should be understandable by both the Parties. For example A wants to...

Looking for C++ Language Classes?

Learn from Best Tutors on UrbanPro.

Are you a Tutor or Training Institute?

Join UrbanPro Today to find students near you
X

Looking for C++ Language Classes?

The best tutors for C++ Language Classes are on UrbanPro

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

Learn C++ Language with the Best Tutors

The best Tutors for C++ Language 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