This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
when you run the above code x will return 64. if 2<<10 then it will not run b'cos of compile time error(possible loss of precision). then i 2<<32. but this time it runs perfectly & return 2. so can anyone know why dis happen?
I believe the issue here is a narrowing primitive conversion as part of an assignment conversion.
2 << 5 is known at compile-time, and will fit into a byte.
2 << 10 is known at compile-time, and will not fit into a byte.
The second operand to the shift operator will be reduced modulo 32 before the shift is carried out. So 2 << 32 is converted to 2 << 0 before the shift is carried out. [ August 13, 2006: Message edited by: Keith Lynn ]