It also allows the compiler to do other optimizations that it would normally not be able to do, both outside and inside the function itself. Anyhow, it's just good practice not to clutter up the global namespace unless something really is globally needed.
re: debugging and stuff
Common practice...and GOOD practice....is to log just about everything and to have multiple log levels that you can turn on and off....or even compile out of your code entirely. Yes, it takes upfront work to build such a thing, but once it's built you take it from project to project and just make minor tweaks to be compatible with the various platforms. Maybe one goes to a serial port...maybe one goes to a file...or to IDE's console. It's such a pleasure to have a bug come in from 5000 miles away, with the zipped up logs, and to be able to immediately see exactly what the problem is.
On one project, when I was a wee lad programmer, they released the code with debug symbols built in. I used that trick over and over in my career. What you do is implement a stack-walker in the global exception handler and using the debug information not only can you log the entire chain of calls, but you can get the exact value of all of your local variables, and you get the exact line numbers the calls were made from, including the exact line number that caused the exception. Talk about a powerful tool!
Anyhow, that's usually a lot more useful than the typically crappy, command line debugger nonsense that come with so many environments.