C Language and Libraries Help (clang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
inline
                                             Up Contents Index Back
─────C/C++ Language─────────────────────────────────────────────────────────
 
  Keyword:  inline
                __inline
 
  Syntax:   inline function_declarator;
 
  Summary:  The inline and __inline keywords allow the compiler
            to insert a copy of the function body in each place the
            function is called. This substitution occurs at the
            discretion of the compiler. The inline keyword is
            available only in C++. The __inline keyword is available
            in both C and C++.
 
  See also: Pragma Control of Inline Functions
            Command-Line Control of Inline Functions
 
     Using inline functions can make your program faster because they
     eliminate the overhead associated with function calls. Functions
     expanded inline are subject to code optimizations not available
     to normal functions.
 
     For example:
 
         inline int max( int a , int b )
         {
             if( a > b ) return a;
             return b;
         }
 
     A class's member functions can be declared inline either by using
     the inline keyword or by placing the function definition within
     the class definition. For example:
 
         class MyClass
         {
         public:
             void print() { cout << i << '\n'; }  // Implicitly inline
         private:
             int i;
         };
                                    -♦-