Thread overview
[Issue 8007] Wrong documentation for '>>'
Dec 23, 2019
berni44
Dec 23, 2019
timon.gehr@gmx.ch
Dec 23, 2019
berni44
Dec 23, 2019
timon.gehr@gmx.ch
Dec 23, 2019
timon.gehr@gmx.ch
Dec 17, 2022
Iain Buclaw
December 23, 2019
https://issues.dlang.org/show_bug.cgi?id=8007

berni44 <bugzilla@d-ecke.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@d-ecke.de
         Resolution|---                         |INVALID

--- Comment #3 from berni44 <bugzilla@d-ecke.de> ---
IMHO the documentation is quite clear here and correct.

First, according to the docs, the opperands have to undergo integer promotion. But for ulong, there is not promotion, therefore the opperand stays ulong.

It also tells, that the result is of the same type as the left side, hence the result is an ulong. And therefore there are no signs. I read ">> is a signed right shift" as "if there is a sign, it will be preserved". That's true here.

--
December 23, 2019
https://issues.dlang.org/show_bug.cgi?id=8007

timon.gehr@gmx.ch changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #4 from timon.gehr@gmx.ch ---
Please stop closing issues just for the sake of it. It's clearly not true that `>>` is a signed right shift.

--
December 23, 2019
https://issues.dlang.org/show_bug.cgi?id=8007

--- Comment #5 from berni44 <bugzilla@d-ecke.de> ---
(In reply to timon.gehr from comment #4)
> Please stop closing issues just for the sake of it.

I do not close issues "just for the sake of it". I closed this one, because I think it's invalid. And I wrote, why I think so. And as Don has IMHO expressed that opinion too, there is some justification in doing so. And in doing so I'll give the next one, who is closing this as invalid even more justification.

> It's clearly not true that `>>` is a signed right shift.

If it were so "clearly not true", as you state, I should see this too. But I can't, so your statement is wrong.

--
December 23, 2019
https://issues.dlang.org/show_bug.cgi?id=8007

--- Comment #6 from timon.gehr@gmx.ch ---
(In reply to berni44 from comment #5)
> ...
> If it were so "clearly not true", as you state, I should see this too. But I
> can't, so your statement is wrong.

https://en.wikipedia.org/wiki/Arithmetic_shift

"In computer programming, an arithmetic shift is a shift operator, sometimes termed a signed shift (though it is not restricted to signed operands)."

--
December 23, 2019
https://issues.dlang.org/show_bug.cgi?id=8007

--- Comment #7 from timon.gehr@gmx.ch ---
(In reply to berni44 from comment #5)
> ... And as Don has IMHO
> expressed that opinion too, there is some justification in doing so.

Don merely clarified what the issue is.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=8007

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P3

--