Advertisements
Offline
adams369
Posts: 13
Joined: Tue Dec 18, 2012 9:30 pm
Hi friends.
What are the advantages of using inline functions in C++.
Please give me brief description about inline functions in c++




Thanks & Regards
Adams
Uschemistoncall
Offline
Twinkle
Posts: 2
Joined: Sun Jun 02, 2013 4:36 am
Hey..


Inline functions are similar to macro. I hope you are familiar with macros :roll: .

In an inline function, the function body is placed on that specific position from where they have been called. However in case of a normal function, the control of the program is passed to the function body.

The major advantage here is that the inline functions are faster to implement. However you can not command the compiler to make your function inline. It will only do so if the function is appropriate. Functions with only one line body are suitable for making inline.

To declare a function inline, all you need to do is to mention the inline keyword before it.
Offline
ballubhai
Posts: 1
Joined: Fri Jun 21, 2013 11:14 am
:mrgreen: [quote] It is typically used for functions that execute frequently.