Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

CProgrammer

inline command

This topic is 5407 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Advertisement
well, as ever: this depends on...

but in general, usage of inline functions is often good when calling small functions much times.





DJSnow
---
this post is manually created and therefore legally valid without a signature

Share this post


Link to post
Share on other sites
Inline creates speed and creates code bloat. But like he said, for small, often-called routines it''s alright.

Share this post


Link to post
Share on other sites
It is said to make the execution of a program faster... but in my case my code executes fast enough that I don''t think I have any inline functions... or maybe I do!

Share this post


Link to post
Share on other sites
Actually, for functions with really tiny bodies like
inline int multiply(int x, int y){
return x*y;
}
...inline functions *decrease* executable size. Placing x*y directly in the executable is much smaller calling a function. Just be careful with calling inline function from inline functions from inline functions...
I''ve always wondered what the compiler does if you create a recursive inline function... but i guess it is always free to create a normal function even if you specify ''inline''.

Share this post


Link to post
Share on other sites
Basically if you have to do it a LOT, because it reduces overhead. In practice, you''re usually going to be putting your Gets and Sets as inlines, and maybe the occassional short operation. The main argument against inlines has historically been that compilers like MSVC6 couldn''t handle stepping into inlines, but I think they fixed that in 7.

-fel

Share this post


Link to post
Share on other sites
There''s sometimes a compiler option that leaves this question for the compiler to decide. Sometimes if the code gets bigger you get more cache misses which slows things down. I think there''s alot of things that should be done before forcing inline.

Share this post


Link to post
Share on other sites
quote:
Original post by felisandria
Basically if you have to do it a LOT, because it reduces overhead. In practice, you''re usually going to be putting your Gets and Sets as inlines, and maybe the occassional short operation. The main argument against inlines has historically been that compilers like MSVC6 couldn''t handle stepping into inlines, but I think they fixed that in 7.

-fel


All of my code is said to be non-inline.


I load code! It''s my whole philosophy!

Share this post


Link to post
Share on other sites
quote:
Original post by marijnh
I've always wondered what the compiler does if you create a recursive inline function... but i guess it is always free to create a normal function even if you specify 'inline'.

As far as I know, the compiler will ignore your 'recommendation' to inline it, as it is not possible/allowed.

In my opinion, the inline mechanism is of great importance in the support of encapsulation/information hiding and the design of abstract data types.

quote:
It is said to make the execution of a program faster... but in my case my code executes fast enough that I don't think I have any inline functions... or maybe I do!

All of my code is said to be non-inline.


Oh, dear...

[ Google || Start Here || ACCU || STL || Boost || MSDN || GotW || MSVC++ Library Fixes || BarrysWorld || E-Mail Me ]

[edited by - Lektrix on September 2, 2003 3:43:29 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!