void f(char) {}
void f(signed char) {}
void f(unsigned char) {}
while the following does not:
void f(int) {}
void f(signed int) {}
void f(unsigned int) {}
?
Thanks in advance.
void f(char) {}
void f(signed char) {}
void f(unsigned char) {}
while the following does not:
void f(int) {}
void f(signed int) {}
void f(unsigned int) {}
?
Thanks in advance.
Quote:Yes, but still, a char is either signed or unsigned
Quote:
Characters can be explicitly declared unsigned or signed. Plain char, signed char, and unsigned char are three distinct types
Quote:Original post by Gage64
Yes, but still, a char is either signed or unsigned
Quote:Original post by ToohrVyk
See 3.9.1 and 7.1.5.2 in the standard.
Quote:Original post by Gage64
One more question: VC++ has an option "Default char unsigned". If a char is neither signed nor unsigned, what does that option do?
Quote:
Objects declared as characters (char) shall be large enough to store any member of the implementation’s
basic character set. If a character from this set is stored in a character object, the integral value of that character
object is equal to the value of the single character literal form of that character. It is implementation defined whether a char object can hold negative values. Characters can be explicitly declared unsigned or signed. Plain char, signed char, and unsigned char are three distinct types. A char, a signed char, and an unsigned char occupy the same amount of storage and have the same alignment requirements (3.9); that is, they have the same object representation. For character types, all bits of the object representation participate in the value representation. For unsigned character types, all possible bit patterns of the value representation represent numbers. These requirements do not hold for other types.
In any particular implementation, a plain char object can take on either the same values as a signed char or an unsigned char; which one is implementation-defined.
Quote:Original post by Gage64
One more question: VC++ has an option "Default char unsigned". If a char is neither signed nor unsigned, what does that option do?