well last time I checked an inline function is a function whose body is substituted directly in every point in the program where the function is called. So when I do this :
#include <iostream>
inline void increment(int n) { n = n + 1; }`
int main() {
int n = 0;
increment(n);
std::cout << "Result " << n;
}
I should have : Result 1. Instead, I get 0.
So how does an inline function work ?
'inline' doesn't replace the text with the function body the way a macro does. It replaces the function call with the EQUIVALENT generated code, so that functionaly it's no different than if it weren't inline.