I agree, I love global variables - when you've not got 'unlimited' resources (such as in a PIC) then it makes absolute sense to use them.I kinda understand the principal of "no globals" when it comes to large team projects. However, most of my projects will only have myself writing code so i'm more comfortable with globals. I do try to reduce my use as much as reasonable as they do eat ram but having function calls just to read/write a private variable eats up program space. Hence, when it comes to \[ \mu \]controllers I tend to use them as needed.
But then if you need a g_string local variable you are screwedHow about g_
A quick look will allow you to realize that it's a global variable.
Recently, I spent some time programming in c#. No global variables allowed at all. Sometimes, they make things so easy.
Unless they're being shared by multiple threads, in which case you have to be sure to use a locking construct (mutex)
Microcontrollers are a different animal. You're not running more than one thread, so there's no risk.
But you have to be careful if the same global variable is being accessed from more than one interrupt.
(Break out the atomic locking gizmo... )