Sean Kelly wrote:
On Jan 21, 2010, at 9:58 AM, Andrei Alexandrescu wrote:

Sean Kelly wrote:
Yeah, I was mostly responding to your earlier comment that casting didn't work 
for you. If you really wanted to cast it would be to ptrdiff_t anyway.
I agree that there's a more fundamental problem though. Weren't we going to 
make implicit narrowing conversions an error?  I know it isn't in the spirit of 
c, but c allows all sorts of horrible nonsense.
Implicit narrowing conversions are already disabled. But code involving cast is 
explicit.

Sure, but if abs() took an int or long then it wouldn't compile without a cast, 
right?

Unfortunately it does because int <-> uint and long <-> ulong automatically. We couldn't disable that.

What we can do is to use "negative overloading" - accept unsigned types but reject them via assert(false, "windows sucks");

Andrei

_______________________________________________
phobos mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/phobos

Reply via email to