Suppose you define a function inside the translation unit with the name of function exactly matching with any of the standard library function.
As the compiler first looks for the definition in the translation unit(s) and then in the library file, so will this cause to use the own version of the function definition or will it cause a diagnostic?
No, the names of functions within namespace
std are not reserved - at least, not in the sense that using the same names outside of namespace
std is forbidden.
However, placing names within namespace
std (except in a few cases, such as specialising certain template functions) gives undefined behaviour.
If you are getting the compiler complaining about ambiguity when calling your functions, where one of the functions has the same name as yours but is in namespace
std, then the cause is probably a
using namespace std in your code. The effect of that, when the compiler encounters a name, is that both your functions and those in namespace
std are valid matches. If the compiler has no reason to prefer one over the other (e.g. they accept the same types of argument) the code will not compile. In that case, the solution is to remove the
using namespace std from your code - there is no way to undo the effects of
using namespace std other than removing it.