Skip to content

[clang-tidy] False positive cert-flp30-c for additional floating-point increment in loop #108049

Closed
@chrchr-github

Description

@chrchr-github
void f(int N, double delta) {
    double d = 0.0;
    for (int i = 0; i < N; ++i, d += delta) {}
}
<source>:3:31: warning: loop induction expression should not have floating-point type [cert-flp30-c]
    3 |     for (int i = 0; i < N; ++i, d += delta) {}
      |

The loop variable is i, which is an integer.
https://godbolt.org/z/8WjhrerdK

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions