Thread overview
[Issue 3468] dmd allows negative values to be assigned to an uint variable
Nov 22, 2015
Mathias LANG
May 16, 2018
Dmitry Olshansky
Dec 17, 2022
Iain Buclaw
November 22, 2015
https://issues.dlang.org/show_bug.cgi?id=3468

Mathias LANG <pro.mathias.lang@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pro.mathias.lang@gmail.com
            Version|D1 (retired)                |D2
                 OS|Linux                       |All

--- Comment #2 from Mathias LANG <pro.mathias.lang@gmail.com> ---
This 'bug' is still around in D2.
It looks like an heritage from C / C++, one of the bad kind.

It allows you to write gems such as:
```
uint func (int i) { return i; }

void main ()
{
  uint v = func(-42);
}
```

@Walter: Would you be okay with the idea of deprecating this ? Related: https://issues.dlang.org/show_bug.cgi?id=259

--
May 16, 2018
https://issues.dlang.org/show_bug.cgi?id=3468

Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh@gmail.com

--- Comment #3 from Dmitry Olshansky <dmitry.olsh@gmail.com> ---
That would make unsigned types way more sane to work with.

And those who like -1 to be shortcut for "all 1's" could use ~0.

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P2                          |P4

--