Is there any difference between the Java and C++ operators?

前端 未结 6 991
后悔当初
后悔当初 2021-01-12 00:16

If you take Java\'s primitive numeric types, plus boolean, and compare it to C++ equivalent types, is there any difference what concerns the operators, like precedence rules

6条回答
  •  没有蜡笔的小新
    2021-01-12 00:42

    The right-shift operator >> is different. In Java it's always an arithmetic shift, i.e. it copies the sign bit into the leftmost bit, whereas in C++ it's implementation-defined whether it's an arithmetic or logical shift. You can get a logical shift in Java using >>>, which doesn't exist in C++.

提交回复
热议问题