- 論壇徽章:
- 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.
復(fù)制代碼
說明char, unsigned char, signed char是三種類型,哈哈,char不像int 一樣默認為signed的,主要是為了不使得前面很多程序不至于被顛覆 |
|