lastchance is correct (*at least, for pre-C++20), but just to give an example: Another possible representation is "sign and magnitude", where a minimum of 7 bits would be for the magnitude, and 1 bit would be for the sign. So under this representation, the range could in fact be [-127, 127]. I have never used a computer with this as the implementation, and I imagine it's more of a historic thing.
Although... with C++20, I'm pretty sure signed integer types now explicitly follow 2's complement.
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2018/p0907r4.html
They did a survey:
In short, the only machine the author could find using non-two’s complement are made by Unisys, and no counter-example was brought by any member of the C++ standards committee. Nowadays Unisys emulates their old architecture using x86 CPUs with attached FPGAs for customers who have legacy applications which they’ve been unable to migrate. These applications are unlikely to be well served by modern C++, signed integers are the least of their problem. Post-modern C++ should focus on serving its existing users well, and incoming users should be blissfully unaware of integer esoterica. |
*So, yes, in combination with the fact that CHAR_BIT must be >= 8, and that integers must use 2's complement as of C++20, I believe this, together, means that SCHAR_MIN is -128 or less, and not -127 or less. I couldn't find a source to directly state this as a fact, but it can extrapolated based on the two requirements.
But this was only a recent guarantee, and the site itself is not updated for C++17 or beyond. To see the latest documentation, I suggest cppreference.com