size_t index=-1;
Jonathan M Davis via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Mar 19 01:44:09 PDT 2016
On Friday, March 18, 2016 21:17:42 Jonathan M Davis via Digitalmars-d-learn
wrote:
> On Friday, March 18, 2016 23:48:32 tsbockman via Digitalmars-d-learn wrote:
> > I'm basically saying, "because information is lost when casting
> > between signed and unsigned, all such casts should be explicit".
>
> See. Here's the fundamental disagreement. _No_ information is lost when
> converting between signed and unsigned integers. e.g.
>
> int i = -1;
> uint ui = i;
> int j = i;
> assert(j == -1);
>
> But even if you convinced us, you'd have to convince Walter. And based on
> previously discussions on this subject, I think that you have an _extremely_
> low chance of that. He doesn't even think that there's a problem that
>
> void foo(bool bar) {}
> void foo(long bar) {}
> foo(1);
>
> resulted in call to the bool overload was a problem when pretty much
> everyone else did. The only thing that I'm aware of that Walter has thought
> _might_ be something that we should change is allowing the comparison
> between signed and unsigned integers, and if you read what he says in the
> bug report for it, he clearly doesn't think it's a big problem:
>
> https://issues.dlang.org/show_bug.cgi?id=259
>
> And that's something that clearly causes bugs in way that converting between
> signed and unsigned integers does not. You're fighting for a lost cause on
> this one.
And I really should have proofread this message before sending it... :(
Hopefully, you get what I meant though.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list