understand that "extern inline" guarantees no function storage is
created (all are inlined). But the following test seems to contradict
what I expect---I found inc_i() is actually compiled as a linkable
function in the a.out
g++ main.cpp call_inc.cpp
nm a.out
......
0804875e W _Z5inc_iv
Can someone explain what's wrong with my understanding? Even better, I
would appreciate if you can show me the comprehensive rule of "static
inline" and "extern inline".
Thanks,
Sean
--------------------------------
//myheader.h
extern int i;
extern void call_inc_i();
extern inline void inc_i(){
i++;
}
-------------------------------
//main.cpp
#include <iostream>
#include "myheader.h"
using namespace std;
int i = 0;
int main(){
inc_i();
cout << "after inc_i()" << i << endl;
call_inc_i();
cout << "after call_inc_i()" << i << endl;
}
--------------------------------
//call_inc.cpp
#include "myheader.h"
void call_inc_i(){
inc_i();
}
--------------------------------------