...
By using different variable names globally and locally, the compiler forces the developer to be more precise and descriptive with variable names.
Exceptions
DCL01-EX0EX1: A function argument in a function declaration may clash with a variable in a containing scope provided that when the function is defined, the argument has a name that clashes with no variables in any containing scopes.
Code Block | ||||
---|---|---|---|---|
| ||||
extern int name; void f(char *name); /* Declaration: no problem here */ /* ... */ void f(char *arg) { /* Definition: no problem; arg doesn't hide name */ /* Use arg */ } |
DCL01-EX1EX2: A temporary variable within a new scope inside of a macro can override a surrounding identifier.
...