Total members 10249 | Gratitudes |It is currently Thu May 17, 2012 8:40 am Login / Join Codemiles


All times are UTC [ DST ]




Post new topic Reply to topic  Quick reply  [ 1 post ] 
Author Question
 Question subject: What are Inline functions?
PostPosted: Wed Jul 04, 2007 12:38 am 
Offline
Beginner
User avatar

Joined: Wed Mar 28, 2007 1:17 pm
Posts: 118
Location: Cairo-Egypt
Has thanked: 0 time
Have thanks: 5 time

What are Inline functions?
--------------------------------------


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ط£آ¢أ¢â€ڑآ¬أ¢â€‍آ¢s 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:

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


Thanks alot.


TOP
 Profile Send private message  
Reply with quote  
Post new topic Reply to topic Quick reply  [ 1 post ] 
Quick reply


  

 Similar topics
 Functions
 inline style for link tag.
 Functions and References
 Calling Functions Dynamically
 What are Virtual Functions?
 Lets Learn C++----->(Lesson 5) Functions

All times are UTC [ DST ]


Users browsing similar posts

Users browsing this forum: No registered users and 1 guest



Jump to:  
Previous Question | Next Question 




Home
General Talks
Finished Projects
Code Library
Games
Tutorials

Java
C/C++
C-sharp
php
Script
JSP/Servlets
Ajax
ASP/ASP.net
Google SEO
Database
Communications
Phpbb3 styles
Photoshop tutorials
Flash tutorials
Find a job






Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team