size_t index=-1;

Mathias Lang via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 16 13:55:02 PDT 2016


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.
>
> -Steve

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/vbeohujwdsoqfgwqgasa@forum.dlang.org 
).


More information about the Digitalmars-d-learn mailing list