You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
vara [1024]bytevarsuint=33// The results of the following examples are given for 64-bit ints.vari=1<<s// 1 has type intvarjint32=1<<s// 1 has type int32; j == 0vark=uint64(1<<s) // 1 has type uint64; k == 1<<33varmint=1.0<<s// 1.0 has type int; m == 1<<33varn=1.0<<s==j// 1.0 has type int; n == truevaro=1<<s==2<<s// 1 and 2 have type int; o == falsevarp=1<<s==1<<33// 1 has type int; p == truevaru=1.0<<s// illegal: 1.0 has type float64, cannot shiftvaru1=1.0<<s!=0// illegal: 1.0 has type float64, cannot shiftvaru2=1<<s!=1.0// illegal: 1 has type float64, cannot shiftvarvfloat32=1<<s// illegal: 1 has type float32, cannot shiftvarwint64=1.0<<33// 1.0<<33 is a constant shift expression; w == 1<<33varx=a[1.0<<s] // panics: 1.0 has type int, but 1<<33 overflows array boundsvarb=make([]byte, 1.0<<s) // 1.0 has type int; len(b) == 1<<33// The results of the following examples are given for 32-bit ints,// which means the shifts will overflow.varmmint=1.0<<s// 1.0 has type int; mm == 0varoo=1<<s==2<<s// 1 and 2 have type int; oo == truevarpp=1<<s==1<<33// illegal: 1 has type int, but 1<<33 overflows intvarxx=a[1.0<<s] // 1.0 has type int; xx == a[0]varbb=make([]byte, 1.0<<s) // 1.0 has type int; len(bb) == 0
Is the comment 1.0 has type int; n == true at line 9 is wrong? Because j is an int32 variable, I think 1.0 should have type int32.
The text was updated successfully, but these errors were encountered:
There is an example at https://golang.org/ref/spec#Operators:
Is the comment
1.0 has type int; n == true
at line 9 is wrong? Becausej
is an int32 variable, I think 1.0 should have type int32.The text was updated successfully, but these errors were encountered: