cppcheck/test/testsuites/danmar-verify/divbyzero.cpp

27 lines
544 B
C++
Raw Normal View History

2019-12-28 22:23:11 +01:00
void pointer1(int *p) {
// cppcheck-suppress verificationDivByZero
return 100000 / *p;
}
void pointer2(int *p) {
// cppcheck-suppress verificationDivByZero
return 100000 / p[32];
}
2019-12-29 19:17:36 +01:00
void float1(float f) {
2019-12-28 22:23:11 +01:00
// cppcheck-suppress verificationDivByZero
return 100000 / (int)f;
}
void stdmap(std::map<int,int> &data) {
// cppcheck-suppress verificationDivByZero
return 100000 / data[43];
}
2019-12-29 19:17:36 +01:00
struct S { int x; };
2019-12-28 22:23:11 +01:00
void struct1(struct S *s) {
// cppcheck-suppress verificationDivByZero
return 100000 / s->x;
}