Shift operator, unexpected result

JG JG at somewhere.com
Wed Jun 9 19:13:10 UTC 2021


I found the following behaviour, as part of a more complicated 
algorithm, unexpected. The program:

     import std;
     void main()
     {
         int n = 64;
         writeln(123uL>>n);
     }

produces:

123

I would expect 0.

What is the rationale for this behaviour or is it a bug?


More information about the Digitalmars-d-learn mailing list