Skip to main content
gamedev.net
🔒 Locked

What does inline Do....

Started by jho Jul 13, 2000 at 4:02 PM 4 replies 300+ views
Original Post
jho
jho
how do I decide which functions to inline, like inline void myfun(); right now i inlined my vector and matrice + - * operations.. I want to know is there a time where inline is bad.. because I don''t really know what inline does with the EXE.. can someone explain?
Gladiator
Gladiator
Inlining a function simply plugs the function code into your code where you called the function (just like a macro, it replaces the function call, with the code). People inline functions in order to get speed, since the stack frame slows down things quite a bit. (If you don''t know what a stack frame is, just keep in mind that it''s slower than an inlined function )


..-=gLaDiAtOr=-..
Zeke
Zeke
It tends to be inadvisable to inline functions that are big and are called lots of times because it increases the size of the program (or so I read in a book)

"People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
Just my thoughts take them as you will. "People spend too much time thinking about the past, whatever else it is, its gone"-Mel Gibson, Man Without A Face
milo
milo
Everything said so far is fine, but remember using inline is a suggestion to the compiler. A variety of things will make the compiler ignore your suggestion. There is a cost/benefit analysis done as part of this determination. Recursive functions will not actually be inline. Even with Microsquishies'' _forceinline key word not every function will be inlined.

I''ve always heard (and generally followed) the rule that you don''t inline functions as you design/code. Inline them later when its time for optimization.

Mike Roberts
aka milo
mlbobs@telocity.com
Gladiator
Gladiator
At least one person took the time to read MadKeithV''s great optimization tutorial! Good going milo!


..-=gLaDiAtOr=-..

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.