-
inline functions
I have a function that I have inlined. The only purpose of this function is so that I don't have to go thru each .h file and replace the section of code evertime I change somthing little.
The function looks like this:
Code:
inline void args(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp);
Now my question is, sence it is inline will take longer than if I did this:
Code:
Args args = {hwnd};
sence that is only taking one variable I think that would be faster than the inline, but would it still be worth using the inline?
-
One is a function, the other is a variable.
Your question doesn't make any sense.
-
ok ahh let me try and re-explain.
The inline function will do:
Code:
Args args = {hwnd};
and that is also the line of code the function is replacing.
But I was wondering if the inline would be worth it or if it would impact speed.
-
inline is one of those premature optimisations which is best avoided until you've finished the code and then have a chance to properly profile the code and make measured changes to the code to improve it.
inline will
- usually make the executable code bigger, but not always
- usually make the code faster, but not always
Single statement 'set' and 'get' functions inside classes are usually OK done as inline functions, but I'd be cautious of applying it early to any other kind of function.