Archived

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

Function inlining

This topic is 6365 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
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