You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
voidexample1()
{
int counter;
if (counter ==0)
writeln("First run");
counter++;
}
voidexample2()
{
string[string] cache;
if (cache isnull)
cache = populateCache();
// ... use cache ...
}
In both cases, we are missing static from the local variable. Though we cannot infer the intent, we can at least determine and point out that comparing the variable with its only possible value at that time doesn't really make sense.
This could be something as complicated as value propagation but also as simple as just checking whether the variable has ever been initialized since it was declared.
The text was updated successfully, but these errors were encountered:
In both cases, we are missing
static
from the local variable. Though we cannot infer the intent, we can at least determine and point out that comparing the variable with its only possible value at that time doesn't really make sense.This could be something as complicated as value propagation but also as simple as just checking whether the variable has ever been initialized since it was declared.
The text was updated successfully, but these errors were encountered: