Community
Participate
Working Groups
Using 0819, compiling this test case leads to a warning for an unnessesary cast, but the result of the two expressions is different. public class Test { public static void main(String[] args) { final long lgLow32BitMask1 = ~(~(long) 0 << 32); final long lgLow32BitMask2 = ~(~0 << 32); System.out.println("lgLow32BitMask1: "+lgLow32BitMask1); System.out.println("lgLow32BitMask2: "+lgLow32BitMask2); } }
Problem is quite subtle, since the unary expression is the first argument of the binary (not a cast expression, but a unary of a cast). Fixed in latest, regression test added.
Verified.