Re:Night of a cascading failure
by scott_s on Tuesday January 22, 2019 @09:48AM
(#18968578)
Standard library operations such as length() on a string are defined to return to return a size_type, which is usually going to be an unsigned integer (https://en.cppreference.com/w/cpp/string/basic_string). So, you don't always have the option of avoiding it. You could convert to a signed integer, but that's usually going to be a narrowing conversion, which will introduce different subtle behavior. Unfortunately, in C and C++, there's no silver bullet for avoiding subtleties with integers.
[ Parent
| on HN ]
There are no comments on this comment yet.