Total members 11894 |It is currently Thu Nov 21, 2024 5:03 pm Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





What are Inline functions? How to define inline function and why ?
--------------------------------------


The Inline keyword helps in speeding up programs by making very small functions execute more efficiently. A compiler compiles a new copy of the function each time it is called. However when you declare a function as inline, when the compiler expands a function call, the function's code gets inserted into the caller's code stream.

Essentially compiler will cut and paste the inline function wherever it is called in your program at compile time. Inline functions save the step of retrieving the function, at the cost of a larger compiled program. The MAX function is a typical (and good) example of a good time to use inline

cpp code
inline int MAX(int x, int y)
{
return (x > y) ? x : y;
}




_________________
Please recommend my post if you found it helpful


Author:
Beginner
User avatar Posts: 109
Have thanks: 5 time
Post new topic Reply to topic  [ 1 post ] 

  Related Posts  to : What are Inline functions?
 inline style for link tag.     -  
 Functions and References     -  
 PHP Array Functions     -  
 What are Virtual Functions?     -  
 using of scanf and printf functions     -  
 Calling Functions Dynamically     -  
 Lets Learn C++----->(Lesson 5) Functions     -  
 program to run shell command line functions     -  
 character running automatically / jump /duck/ functions     -  



Topic Tags

C++ Basics






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com