C C++ Function name conflicts and crash inconsistency
===

Could someone explain the behind the scene causes of inconsistent crashes for this user error.

Here is the main function  

include "foo.h"  
inline int Bar(const int &a)  
{  
...  
}  
...  
int b=Bar(a);

In "foo.C" there is also a copy of the function  
inline in Bar(const int &a) 

Here is the problem. I do not own foo.h nor foo.C, and there is no declaration of Bar(int) in foo.h. 
Everything compiles and works fine with older version of foo.h and foo.C  
After my co-worker updated some other functions in his foo.C, the code still compiles fine but it started to crashes on execution.  
Debugging through ddd showed that when my main function calls for Bar(),it is actually calling the Bar() inside foo.C instead of my own defined Bar().  
Of cause the fix was to static my own function or change the name of my own Bar() function.

I know writing code like this disorganized and is prone to error like this. Could someone explain to me why would the code crashes inconsistently?

Thank you all

Regards


