Сообщение Re[2]: uint.MaxValue << 32 == 0xFFFFFFFF от 15.07.2021 15:54
Изменено 15.07.2021 16:04 pugv
Re[2]: uint.MaxValue << 32 == 0xFFFFFFFF
Здравствуйте, Ночной Смотрящий, Вы писали:
НС>И где ты здесь UB увидел? Все там defined
https://docs.microsoft.com/en-us/cpp/cpp/left-shift-and-right-shift-operators-input-and-output?view=msvc-160
И всё же, зачем?
НС>И где ты здесь UB увидел? Все там defined
The result of a shift operation is undefined if additive-expression is negative or if additive-expression is greater than or equal to the number of bits in the (promoted) shift-expression.
unsigned int int4 = int1 << 32; // C4293: '<<' : shift count negative or too big, undefined behavior
https://docs.microsoft.com/en-us/cpp/cpp/left-shift-and-right-shift-operators-input-and-output?view=msvc-160
И всё же, зачем?
Re[2]: uint.MaxValue << 32 == 0xFFFFFFFF
Здравствуйте, Ночной Смотрящий, Вы писали:
НС>И где ты здесь UB увидел? Все там defined
https://docs.microsoft.com/en-us/cpp/cpp/left-shift-and-right-shift-operators-input-and-output?view=msvc-160
И всё же, зачем?
EDIT. Это про C++ такое написано...
НС>И где ты здесь UB увидел? Все там defined
The result of a shift operation is undefined if additive-expression is negative or if additive-expression is greater than or equal to the number of bits in the (promoted) shift-expression.
unsigned int int4 = int1 << 32; // C4293: '<<' : shift count negative or too big, undefined behavior
https://docs.microsoft.com/en-us/cpp/cpp/left-shift-and-right-shift-operators-input-and-output?view=msvc-160
И всё же, зачем?
EDIT. Это про C++ такое написано...