Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Comparison result is always the same #1372

Closed
DimitriPapadopoulos opened this issue Aug 30, 2021 · 0 comments · Fixed by #1373
Closed

Comparison result is always the same #1372

DimitriPapadopoulos opened this issue Aug 30, 2021 · 0 comments · Fixed by #1373

Comments

@DimitriPapadopoulos
Copy link
Contributor

This piece of code:

    if (pos >= 0) {
        for (i = pos; pos >= 0; i--) {
            switch (prog[i]) {

is flagged by LGTM.com:

Comparison result is always the same
Comparison is always true because pos >= 0.

Indeed, the comparison should probably involve i instead of pos:

    if (pos >= 0) {
        for (i = pos; i >= 0; i--) {
            switch (prog[i]) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant