I don’t recall ever making that mistake in C. In the industrial computers I work with daily, the local scope takes precedent. Usually it gets interesting when the OIT display doesn’t match the variable in the subroutine. The OIT programs default to the global variables. Several hours after you notice the difference is when you realize you have a local and a global variable of the same name.
Let the OP stew on the issue for while and then post up what happens in C/C++.