implicit ubyte casting
Brad Roberts
braddr at bellevue.puremagic.com
Thu Oct 1 15:42:59 PDT 2009
On Thu, 1 Oct 2009, Saaa wrote:
> I think is very bug-prone, isn't it obvious iub should be -5?
>
> ubyte ub = 5;
> int iub = -ub; // iub now is 251
>
> What is the reasoning to do it this way?
The inclusion of the 'int' part obscures what I think the real problem
is..
Does it make sense to use uniary-minus on a unsigned type?
My answer.. no. But the counter argument that will likely come up is
generic behavior. So, to prempt that.. does unary minus have any useful
meaning for MOST types? My answer is still no. :)
Later,
Brad
More information about the Digitalmars-d-learn
mailing list