Advertisement

inline funcs

Started by February 29, 2000 06:39 PM
12 comments, last by NewDeal 24 years, 6 months ago
At least in g++, inlined functions that are inlined can contain function calls. ex:
inline void p(void) {printf("Hi there.\n");}
can be inlined.

But I believe most compilers won''t inline functions that have control structures. i.e. for loops, while loops, etc. Or I could be thinking of something completely different.
I believe your right about the for/while loops as well as switches. About the function calls inside an inline function, wouldn't the function that you call have to be inlined as well? .. oh, maybe not actually. I think I'll have a gander at the docs again.

Compiling in release mode does not give as great a leap in speed as some seem to believe. It will not magicly optimize your code and make it run like professionaly developed games.

It will give you a small speed increase, but mostly because DirectX won't be spitting out all that almost useless debug information.

Edited by - Gromit on 3/1/00 1:37:45 AM
William Reiach - Human Extrodinaire

Marlene and Me


Advertisement
Ok, let''s say I have the p() function from my previous post. whenever the compiler sees p() it''ll substitute printf("Hi there.\n"); If you just do a compile to assembly code, it''s pretty easy to see.

Oh some compilers will also not inline function with local variables, especially static local variables.
After I posted, the concept clicked in for me.

Anyways, the compiler will not inline your UpdateFrame() function. Besides, it doesn''t really make sense. UpdateFrame only appears once in your source file.
William Reiach - Human Extrodinaire

Marlene and Me


This topic is closed to new replies.

Advertisement