inline functions
play

Inline Functions http://cs.mst.edu #include <iostream> using - PowerPoint PPT Presentation

Inline Functions http://cs.mst.edu #include <iostream> using namespace std; float calc_iq( const float hatsize, const int age, const float num_feet); inline float square(const float x) {return x*x;} void some_other_function (char


  1. Inline Functions http://cs.mst.edu

  2. #include <iostream> using namespace std; float calc_iq( const float hatsize, const int age, const float num_feet); inline float square(const float x) {return x*x;} void some_other_function (char broiled, float other_stuff); int main() { float y = square (6.2); return 0; } http://cs.mst.edu

  3. #include <iostream> using namespace std; float calc_iq( const float hatsize, const int age, const float num_feet); inline float square(const float x) {return x*x;} void some_other_function (char broiled, float other_stuff); int main() { float y = square (6.2); return 0; } http://cs.mst.edu

  4. #include <iostream> using namespace std; float calc_iq( const float hatsize, const int age, const float num_feet); inline float square(const float x) {return x*x;} void some_other_function (char broiled, float other_stuff); int main() int main() { { float y = 6.2 * 6.2; float y = square (6.2); return 0; return 0; } } http://cs.mst.edu

  5. When and Why  You will inline a function only if it is relatively small  Reduces some of the overhead cost of calling a function  With the function being called once, twice, or even 1000 times, the speed up will almost certainly not be noticed http://cs.mst.edu

  6. End of Session http://cs.mst.edu

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend