Thread: Inline: I don't get it

  1. #16
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    In Fili's example above, I still don't see the advantage of adding "inline"...would not the very same result occur without the "inline" there?

    Edit: By "above", I mean on the previous page, 6 posts up from the bottom

  2. #17
    Registered User linuxdude's Avatar
    Join Date
    Mar 2003
    Location
    Louisiana
    Posts
    926
    all functions will generate the same results whether or not they are inline it is there to help with optimization. You should use a profiler and see if it would help to make a function inline.

  3. #18
    Sweet
    Join Date
    Aug 2002
    Location
    Tucson, Arizona
    Posts
    1,820
    ok think of inline like this basically insted of calling that function the compiler puts the code there instead eg.
    Code:
    #include <iostream>
    using namespace std;
    
    inline void foo()
    {
        cout<<"Foo action";
    }
    int main()
    {
        foo();
        return 0;
    }
    actully would be this this(correct me if im wrong)

    Code:
    #include <iostream>
    using namespace std;
    
    inline void foo()
    {
        cout<<"Foo Action";
    }
    int main()
    {
        cout<<"Foo Action"//used to be foo();
        return 0;
    }
    Woop?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. When to inline your *tors
    By Angus in forum C++ Programming
    Replies: 43
    Last Post: 10-29-2008, 03:38 PM
  2. Code review
    By Elysia in forum C++ Programming
    Replies: 71
    Last Post: 05-13-2008, 09:42 PM
  3. Certain functions
    By Lurker in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2003, 01:26 AM
  4. bit shifting
    By Nor in forum C++ Programming
    Replies: 9
    Last Post: 08-08-2003, 11:55 AM
  5. Replies: 5
    Last Post: 09-17-2001, 06:18 AM