Hi there,

  I am looking for a warning in gcc that would warn me about
potentially dangerous operation, such as the one describe in (*). I
understand this is perfectly valid operation, but it looks to me like a
valid warning.

  I tried the following so far:

-Wall -Wextra -Wconversion -Wsign-compare

Thanks
-Mathieu

(*)
#include <vector>

int main()
{
  std::vector<int> v;
  int s = 0;
  for(unsigned int i = 0; i < v.size() - 1; ++i) // v.size() == 0
    {
    s += v[i] * v[i+1];
    }

  return 0;
}

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
http://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to