February 24, 2008Re: My Kingdom For ...
Posted in reply to Janice Caron
Janice Caron wrote: > On 24/02/2008, Janice Caron <firstname.lastname@example.org> wrote: >> I think it would be better if widening type promotions were not done >> where not necessary. Yes. But that's more work right now. > > "where not necessary" now becomes the problem. When is it necessary? > > ubyte n = 255; > auto m = n + 2; > > what type is m? > > uint x = 0xFFFFFFFF; > auto y = x + 2; > > what type is y? > > These things obviously need clearly defined rules. Currently the rules > seem to be, if in doubt, use int. I don't know if that's necessarily > correct in all cases. I think this is all covered by polysemous types; Andrei in particular has given it considerable thought. As soon as they're introduced the problem should disappear for D2. There's actually a fallacy in the page about warnings. They are not optional. You can only use -w if the all of the libraries you are using support compilation with -w. Therefore, library developers are under considerable pressure to provide code which compiles with -w. And therefore, library developers cannot use bitwise | & ^ operations on anything other than an int. ( |=, &=, ^= don't generate the warning, so they're OK).
Copyright © 1999-2017 by the D Language Foundation