A bit of a weird one and not very practical, but I'm trying some random things with inline in cpp and I thought about trying this:
inline void foo(void){static int x=0; x++; cout << x << '\n'; return;};
and in another .cpp file I've got:
inline void foo(void){static int x=0; x=x+2; cout << x << '\n'; return;};
Now, this works for some reason( same function type/name) but the different body, they both share the same 'x'
but their definition is not the same. I would expect the compiler to complain, but it's not. why is that?