Skip to content

Commit 61d18ce

Browse files
authored
Merge pull request #788 from u-s/bugfix/variable-shadowing-simple-moving-average
fix variable shadowing in check_results(simple moving average example)
2 parents be85263 + 217f77a commit 61d18ce

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

example/simple_moving_average.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ bool check_results(const std::vector<float>& values, const std::vector<float>& s
6060

6161
int semiWidth = wSize/2;
6262

63-
bool res = true;
63+
bool ret = true;
6464
for(int idx = 0 ; idx < size ; ++idx)
6565
{
6666
int start = (std::max)(idx - semiWidth,0);
@@ -76,11 +76,11 @@ bool check_results(const std::vector<float>& values, const std::vector<float>& s
7676
if(std::abs(res-smoothValues[idx]) > 1e-3)
7777
{
7878
std::cout << "idx = " << idx << " -- expected = " << res << " -- result = " << smoothValues[idx] << std::endl;
79-
res = false;
79+
ret = false;
8080
}
8181
}
8282

83-
return res;
83+
return ret;
8484
}
8585

8686
// generate a uniform law over [0,10]

0 commit comments

Comments
 (0)