https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83407

--- Comment #5 from Jonny Grant <jg at jguk dot org> ---
I appreciate that people rely on this behavour, we found in code reviews
various bugs. It is more a question of how to detect underflow, without running
the program.

It is often the case in C++ STL code we have observed. In the case where the
vector is empty, this amount is wrong.. so our code review found this, and I
wanted to see if there was a way to detect by the compiler.

printf("vec size minus header: %zu", vec.size() -1);

Reply via email to