On 3/16/16 4:55 PM, Mathias Lang wrote:
On Wednesday, 16 March 2016 at 20:11:41 UTC, Steven Schveighoffer wrote:
On 3/16/16 2:40 PM, Laeeth Isharc wrote:
should it be a compiler warning to assign a negative literal to an
unsigned without a cast ?

Why? They implicitly convert.

int  x = -1;
uint y = x;

I don't see a difference between this and your code. And we can't
change this behavior of the second line, too much arguably valid code
would break.

We can change it, and we should. But it should be deprecated properly,
and we should put in place enough candy to make it viable (See
http://forum.dlang.org/post/vbeohujwdsoqfgwqg...@forum.dlang.org ).

No, please don't. Assigning a signed value to an unsigned (and vice versa) is very useful, and there is no good reason to break this.

-Steve
  • Re: size_t index=-1; Mathias Lang via Digitalmars-d-learn
    • Re: size_t index=-1; Jonathan M Davis via Digitalmars-d-learn
    • Re: size_t index=-1; Steven Schveighoffer via Digitalmars-d-learn
      • Re: size_t index=-1; Mathias Lang via Digitalmars-d-learn
        • Re: size_t index... Steven Schveighoffer via Digitalmars-d-learn
          • Re: size_t i... Johan Engelen via Digitalmars-d-learn
          • Re: size_t i... Mathias Lang via Digitalmars-d-learn
            • Re: siz... Steven Schveighoffer via Digitalmars-d-learn
              • Re:... Marc Schütz via Digitalmars-d-learn
              • Re:... tsbockman via Digitalmars-d-learn
                • ... Steven Schveighoffer via Digitalmars-d-learn
                • ... tsbockman via Digitalmars-d-learn
                • ... Jonathan M Davis via Digitalmars-d-learn
                • ... Jonathan M Davis via Digitalmars-d-learn
                • ... tsbockman via Digitalmars-d-learn

Reply via email to