将会发生什么“1<< (-1)"在G ++? [英] What will happen to "1 << (-1)" in G++?
本文介绍了将会发生什么“1<< (-1)"在G ++?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
左移负数,我会得到1/2吗?
谢谢。
解决方案
左移负数,我会得1/2吗?
为什么不亲自尝试?计算机科学的伟大优点在于,它在许多方面都是一门实验学科,而不是纯粹的理论学科。
"先生。肯" <先生。 Ken @ asdfschrieb im Newsbeitrag
news:45 ******** @ news.starhub.net.sg ...
左移负数,我会得1/2吗?
如果移位表达式的右操作数是
为负数或大于或等于用于的位数,则表达式的结果是未定义的代表
左边的操作数。
亨氏
" Heinz Ozwirk" < ho ***** @ arcor.dewrote in message
news:45 ********************** @ newsspool1。 arcor-online.net ...
" Mr。肯" <先生。 Ken @ asdfschrieb im Newsbeitrag
news:45 ******** @ news.starhub.net.sg ...
左移负数,我会得1/2吗?
如果移位表达式的右操作数是
为负数或大于或等于用于的位数,则表达式的结果是未定义的代表
左边的操作数。
Heinz
谢谢。
Left shift by negative numbers, will I get 1/2?
Thanks.
解决方案
Left shift by negative numbers, will I get 1/2?
Why not try it for yourself? The great virtue of computer science is
that in many ways it''s an experimental discipline, not a purely
theoretical one.
"Mr. Ken" <Mr. Ken@asdfschrieb im Newsbeitrag
news:45********@news.starhub.net.sg...Left shift by negative numbers, will I get 1/2?The result of a shift expression is undefined if its right operand is
negative or greater than or equal to the number of bits used to represent
its left operand.
Heinz
"Heinz Ozwirk" <ho*****@arcor.dewrote in message
news:45**********************@newsspool1.arcor-online.net..."Mr. Ken" <Mr. Ken@asdfschrieb im Newsbeitrag
news:45********@news.starhub.net.sg...Left shift by negative numbers, will I get 1/2?
The result of a shift expression is undefined if its right operand is
negative or greater than or equal to the number of bits used to represent
its left operand.
Heinz
Thank you.
这篇关于将会发生什么“1<< (-1)"在G ++?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文