KOE wrote:Однако куча народу пользует char и unsigned char для хранения 8-битных чисел.
lvd wrote:фк0, ящитаю, фигнёй страдает.
deathsoft wrote:Могут быть системы где есть байты, а чар не 8бит, а например 16, чар не обязан быть 8 битным, для этого и есть uint8_t.
KOE wrote:Тогда объясните наличие signed/unsigned char. Если это буква, то зачем ей знак?
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 compromise 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.
deathsoft wrote:Могут быть системы где есть байты, а чар не 8бит, а например 16, чар не обязан быть 8 битным, для этого и есть uint8_t.
Users browsing this forum: No registered users and 4 guests