Skip to main content
GameDev.net gamedev.net
🔒 Locked

__forceinline

Started by drslush Jul 21, 2003 at 1:50 PM 8 replies 1.6k views
Original Post
drslush
drslush
Can anyone explain to me why MSVC 6 refuses to inline any code? I have some member functions defined inside a class declaration. This should inline them, but it didn''t work. I also tried using __forceinline, but no luck there either. I tried playing with the /Obx options, but the compiler gives me the error: " ignoring unknown option ''/Ob1'' " Can someone point out my problem?
Sneftel
Sneftel
Post your code. At the very least, post the class declaration, and the file that doesn''t inline the function properly.
drslush
drslush
Any function, any code. It doesn't matter what I do, it doesnt inline anything. Here is an example:


__forceinline void fooBar()
{
int i = 0;
i++;
}

int main()
{
fooBar();
return 0;
}


[edited by - drslush on July 21, 2003 3:00:15 PM]
glassJAw
glassJAw
Debug builds have inlining completely disabled.
Check your project properties.
drslush
drslush
It was a release build.... Anyway I found my problem. You need the pro edition or enterprise edition for inlining. That was what I suspected from the start, but it didn''t say anything in the documentation for inline.
Promit
Promit
quote:
Original post by Anonymous Poster
MSVC6 will only inline functions in header files


Not true, AFAIK.
SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.
Hazelnuss
Hazelnuss
quote:
Original post by drslush
It was a release build.... Anyway I found my problem. You need the pro edition or enterprise edition for inlining. That was what I suspected from the start, but it didn''t say anything in the documentation for inline.


WTF!? Is that true??

drslush
drslush
Yes, its true. Look at the assembly output. Standard edition doesnt do ANY optimiziations.

Topic Locked

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

Sign in to reply to this topic.