On Thursday, 8 March 2018 00:02:58 UTC+1, Ian Lance Taylor wrote:
> If we ignore the type context, then
> var v int64 = 1 << s
> fails on 32-bit systems if s > 31 (because 1 is assigned type int,
> which is 32 bits, and the shifting a 32-bit value by more than 31 bits
> gives you zero).
> If we don't ignore the type context, then in
> var v float32 = 1 << s
> fails because we can't shift a float32.
Thanks! This explanation is very clear. The spec already contains
an example of this rule: var k = uint64(1<<s). Maybe it would be
good to add di...'s example as an illegal shift example too?
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
For more options, visit https://groups.google.com/d/optout.