CKTIS / C++
signed char — a small signed integer type
`signed char` is a built-in signed integer type, distinct from `char` and `unsigned char`. It occupies one C++ byte but need not have exactly 8 bits. It can represent small numeric values, including negative ones.
Version: C++23; repository compiler flag, production runtime not attested
Syntax
signed char name{value};signed char is a standard signed integer type. It is distinct from char and unsigned char, even when char has the same range. In C++23 its representation is two's complement; its range includes at least the values from -128 to 127.
sizeof(signed char) is always 1, meaning one C++ byte, not necessarily 8 bits. Its width is implementation-defined and is at least 8 bits. Do not therefore assume that signed char is a portable name for an exactly 8-bit type.
In operations such as value + 1, the signed char value is promoted to int, so the result does not have type signed char. In the example, static_cast<int>(value) explicitly selects numeric output, and static_assert checks the size at compile time. The chosen values make the result independent of the byte width.
This entry targets C++23. The supplied source is an evolving working draft, not a frozen C++23 publication. The repository compiler flag does not attest the version of the production runtime.
Examples
#include <iostream>
int main() {
signed char value{-12};
static_assert(sizeof(signed char) == 1);
int next = value + 1;
std::cout << static_cast<int>(value) << ' ' << next << '\n';
}
Result
-12 -11
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.