I just saw some C++ code like this. It was using a condition to decide whether to walk forward or backward through a std::vector. The compiler doesn\'t complain, b
std::vector
Is it safe to use negative integers with size_t?
No, it is dangerous. Overflow.
size_t a = -1; std::cout << a << "\n";
Output:
4294967295 // depends on the system, largest value possible here