LINUX.ORG.RU

История изменений

Исправление shdown, (текущая версия) :

Ты совсем элементарных вещей не знаешь, получается? Вот стандарт C99, в остальных версиях языков C и C++ написано то же самое:

https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf

§6.2.5, clause 9

The range of nonnegative values of a signed integer type is a subrange of the corresponding unsigned integer type, and the representation of the same value in each type is the same.31) A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type.

От сдвига, клоун.

Стандарт не считает такое поведение «переполнением» вообще, см. выше. В любом случае ты утверждаешь, что поведение, которое определено стандартом, это UB.

Исходная версия shdown, :

Ты совсем элементарных вещей не знаешь, получается? Вот стандарт C99, в остальных версиях языков C и C++ написано то же самое:

https://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf

§6.2.5, clause 9

The range of nonnegative values of a signed integer type is a subrange of the corresponding unsigned integer type, and the representation of the same value in each type is the same.31) A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest value that can be represented by the resulting type.

От сдвига, клоун.

Стандарт не считает такое поведение «переполнением» вообще, см. выше.