Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Desmond

Function inlining

This topic is 6673 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I made this part of code and I just wanted to know if it is allright... It''s concerning C++ function inlining... In my DATA.H file I got this code: // DATA.H inline void requestData(void); And in my DATA.CPP file I got this // DATA.CPP extern void requestData(void) { // My code goes here } if I use the function requestData in another file now will it be treated as inline even if the body of the function is not in the header file?

Share this post


Link to post
Share on other sites
Advertisement
No, this won''t work without a global optimizer that is applied at the linking stage. The Intel compiler has one, but I''m not sure whether you can force it to inline functions. With most compilers (including VectorC, GNU C/C++ and Visual C/C++) you need to put the definition of your inline function in the header file.


Andrew Richards
CodePlay - http://www.codeplay.com

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!