CASE 1 (Definition and declaration in same source file)
Suppose both my prototype and definition of global function is in .cpp file. Where should I write inline keyword to make compiler know?
- In the prototype
- In the definition
- Both
CASE 2 (Definition and declaration in same header file)
If I have declared prototypes in .h file I want to make that function inline in more than one .cpp file using it, then should I define the function (to be inlined) in that .h file and include it to individual .cpp files? If yes, then in this case where inline keyword should be used?
CASE 3 (Definition in Header file and declaration in Source file)
If the prototype is in a header file, definition in a source file (in which other functions use the inline function), where must the inline keyword be used?
- In the declaration in header file
- In the definition in source file
- In both