extern data and static diffenece since static is used for keeping the value after existing function, extern use the value in other module. are they the same?
I do agree that a variable can be global without being used extern, but why the heck would anyone do that? So that you can watch that variable from outside the scope of the file in which it is declared. If the variable isn't global, some debuggers can't watch it if it is out of scope (if you're not debugging some code in that source file). Of course, not all debuggers work this way. Jon
"If the variable isn't global, some debuggers can't watch it if it is out of scope" In uVision, to watch a function's static local variable from outside the function, you have to give the fully-qualified name like "\\module\function\fred" instead of just "fred" I presume it would be similar for file-scope objects declared 'static'?
"In uVision, to watch a function's static local variable from outside the function, you have to give the fully-qualified name like '\\module\function\fred' instead of just 'fred'" Having just been trying to watch a 'static' local, I now remember that it's worse than that: Actually, you always have to give the fully-qualified name - whether or not the variable is currently in-scope. This is a pain, as it means that the pop-up display of the current value doesn't work, the variable doesn't appear in the 'locals' window, and you can't add it to a Watch window by right clicking. :-( PS The syntax is actually '\module\function\fred' - only a single backslash to start