Local static variables must have unique names within a function's scope.
tipdbmp
email at example.com
Fri Jan 19 14:16:24 UTC 2018
> Mostly, it's just a bad idea - it's very easy for a person
> reading the code after you've written it to get the two x's
> mixed up.
// example from: 19.17.1.3
void main()
{
{ static int x; }
{ static int x; } // error
{ int i; }
{ int i; } // ok
}
I don't really see how the 'static' storage class would make 2
variables with the same name in different scopes "easier to mix
up" compared to 2 variables with the same name in different
scopes but declared without the 'static' keyword.
More information about the Digitalmars-d-learn
mailing list