What the article says is that:
> As so often happens, the code simplification that comes from making n
> unsigned can complicate other kinds of programs. Suppose, for example, that
> we want to visit the elements of x in reverse order.
In the video Bjarne Stroustrup shares the same point of view like the authors
of the Google C++ style guide (in the video, Google developer Chandler Carruth
responds right before BS at 12:15min):
1. Use signed integers unless you need two's complement arithmetic or a
bit pattern.
2. Use the smallest integer type possible when you must store many integers.
3. When in doubt, use 64-bit integers.
4. "Stop worrying and use tools to catch it when you get it wrong."
Additionally, BS recommends to never mix signed and unsigned arithmetic. The
problem that I have with these guidelines is that they are given without
reasoning. I understand that BS designed C++ but that does not mean that he
automatically has the best advice. Similary, if you accept everything in the
Google C++ style guide at face value, then you cannot use exceptions, enums
must be prefixed with "k", you have to indent with two spaces, and use the
Stroustrup indent style
(
https://en.wikipedia.org/wiki/Indent_style#Variant:_Stroustrup).
The Google C++ style guide gives two arguments for using signed integers:
* The reverse loop example does not work.
* "Equally bad bugs can occur when comparing signed and unsigned variables.
Basically, C's type-promotion scheme causes unsigned types to behave
differently than one might expect."
I cannot even remember when I wrote the last reverse loop but let me give you
the equivalent example for a problem intrinsic to signed integers:
```c++
signed_integer_t n = container.size()
```
If there are more than `LLONG_MAX` elements in the container, you have
undefined behavior. The second statement is not an argument (the type-promotion
scheme behaves exactly how you would expect it if you read the C++ standard)
but if you must to compare signed and unsigned values, you have to
* first check if the signed integer is less than zero,
* if the signed integer is positive, compare signed and unsigned integer.
Mixing signed and unsigned arithmetic is indeed a bad idea but it also
well-defined if both variables have the same rank. Thus, if object dimensions
are of type `std::size_t` and increments of type `std::ssize_t`, then an
operation `dimension + increment` will return the correct result.
In conclusion, if you use BLAS and C or C++ memory allocation, then you must
mix signed and unsigned arithmetic at some point. I prefer to have the
conversion done by the BLAS C++ interface.