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
Java specifies more about the order of evaluation of expressions than C++, and C++ says that you get undefined behavior if any of the legal evaluation orders of your expression modify an object twice between sequence points.
So, i++ + i++
is well defined in Java, but has undefined behavior (no diagnosis required) in C++. Therefore you can't blindly copy expressions from Java to C++.
For bitwise operators, Java specifies two's-complement representation of negative numbers whereas C++ doesn't. Not that you're likely to encounter another representation in C++, but if you did then you would find for example that -2 | 1
is always -1
in Java, but is -2
in a C++ implementation using 1s' complement.