inline command
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
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
Inline creates speed and creates code bloat. But like he said, for small, often-called routines it''s alright.
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!
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''.
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''.
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
-fel
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.
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!
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement