Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Argh, VC++ inlines.   Message List  
Reply | Forward Message #4129 of 15019 |
RE: [gbadev] Argh, VC++ inlines.


Hey Thomas,

If you put inline before a function, that function has to exist in the
header file.
Otherwise, you'll get unresolved external symbols.

There is a tradeoff of being able to step through inline functions and
speed.
A solution to this is to make your own INLINE macro,
that in #ifdef _DEBUG evaluates to nothing and otherwise evaluates to
inline.

You then place the inline functions in a separate file, call it foo.inl for
example.
Then the h file looks like:
#ifndef _DEBUG
#include "foo.inl"
#endif // !_DEBUG

In the .cpp file, it looks like:
#ifdef _DEBUG
#include "foo.inl
#endif // _DEBUG

This means, when I'm in debug...
I don't want to treat these functions as truly inline.
Instead, include them in the implementation file.

In release, it means...
Treat these inline functions, I'm looking for max speed.


While inline functions are a good thing in general (especially for simple
accessor manipulator code), you should a profiler on your code.
This way you have real data to figure out what is taking the most time.

- Jeff





Sun Jun 3, 2001 1:42 pm

bodisafa@...
Send Email Send Email

Forward
Message #4129 of 15019 |
Expand Messages Author Sort by Date

The situation is: I'm trying to write an emulator. It runs a sum total of 2 public domain demos. One of them runs ok, the other one runs VERY SLOW. My ARM ...
Thomas Happ
sorcererxiii@...
Send Email
Jun 3, 2001
12:38 pm

You are specifying the /Ob1 or /Ob2 option in the compiler settings ? Also, remember to use __forceinline so that it will be forced inline (although just...
David Cowan
david.cowan@...
Send Email
Jun 3, 2001
1:11 pm

Hey Thomas, If you put inline before a function, that function has to exist in the header file. Otherwise, you'll get unresolved external symbols. There is a...
Jeff Dixon
bodisafa@...
Send Email
Jun 3, 2001
1:51 pm

Are you sure that function call overhead slow down you code so much??? Naaa, you should optimize your code at all and then inline it!!! ... From: "Thomas Happ"...
Fausto
faustus@...
Send Email
Jun 3, 2001
5:18 pm

Hey, I just wanted to thank everyone for their advice on this subject, you were very thorough. Sadly I wasn't even aware that VC++ had a profiler built in....
Thomas
sorcererxiii@...
Send Email
Jun 5, 2001
8:31 am
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help