signed
suggest changeA keyword that is part of certain integer type names.
- When used alone,
int
is implied, so thatsigned
,signed int
, andint
are the same type. - When combined with
char
, yields the typesigned char
, which is a different type fromchar
, even ifchar
is also signed.signed char
has a range that includes at least -127 to +127, inclusive. - When combined with
short
,long
, orlong long
, it is redundant, since those types are already signed. signed
cannot be combined withbool
,wchar_t
,char16_t
, orchar32_t
.
Example:
signed char celsius_temperature;
std::cin >> celsius_temperature;
if (celsius_temperature < -35) {
std::cout << "cold day, eh?\n";
}
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents