Well, does it?
Printable View
Well, does it?
It helps in speed-critical procedures, sometimes. Essentially, IF your compiler actually makes the function inline (declaring it inline does NOT force the compiler to actually make it inline, it's more of a suggestion) you save a slight bit of time and memory by removing the overhead that goes with a procedure call.
The only place you'd notice any difference would be in functions that are called repeatedly, and with machines getting faster and faster, instruction caches getting more intelligent and doing branch prediction, etc., the overhead to call a function is getting proportionally smaller and smaller.
inline does not only remove overhead to function calls, it also allows the compiler to make more sophisticated optimizations based on larger lengths of code generated by inlining a function.
Just a question, what would happen with an inline recursive function?
>Well, does it?
http://www.gotw.ca/gotw/033.htm
"Does it make anyy difference if a function is "inline""
No, of course not. It's just a fancy trick to impress your friends.
Check out this FAQ on inline functions:
http://www.parashift.com/c++-faq-lit...functions.html