- 论坛徽章:
- 0
|
找到句话
- In the ANSI C Draft Standard, the keyword signed was added, introducing a signed char type for all platforms. The new keyword solved the problem of not being able to use signed char portably, but at this point the standard committee could not mandate plain char to be signed. It would break a lot of code and upset vendors as well as users.
- The comprimise was to make signed char a type distinct from the two existing character types, while requiring char to have the same representation and values as either signed char or unsigned char. In other words, a char must look exactly like a signed char or unsigned char to the hardware; which one is implementation-defined. C++ later adopted this compromise for compatibility with C, so both languages now have three distinct char types.
复制代码
说明char, unsigned char, signed char是三种类型,哈哈,char不像int 一样默认为signed的,主要是为了不使得前面很多程序不至于被颠覆 |
|