On Wednesday, 9 June 2021 at 19:13:10 UTC, JG wrote:
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?

This is undefined behavior as in other languages, see ยง3 in https://dlang.org/spec/expression.html#shift_expressions.

Reply via email to