ВходНаше всё Теги codebook 无线电组件 Поиск Опросы Закон Среда
10 июля
346807 Топик полностью
rezident (12.08.2012 22:06, просмотров: 178) ответил Flasher на Люди, имею строчку кода в гнутом с для авр if (a==((b^c)+(d^e)+(f^g)))Все переменные a-g объявлены как unsigned char. Выполнит ли компилятор преобразование типов справа? Мне нужна сумма по модулю 256, а выходит какая-то фигня.EF==A6+4A+FF вот
Стандарт C99 сообщает. 
If an int can represent all values of the original type, the value is converted to an int; otherwise, it is converted to an unsigned int. These are called the integer promotions. 48) All other types are unchanged by the integer promotions.
48) The integer promotions are applied only: as part of the usual arithmetic conversions, to certain argument expressions, to the operands of the unary +, -, and ~ operators, and to both operands of the shift operators, as specified by their respective subclauses.