On 22 June 2010 08:50, Lars Tandle Kyllingstad <[email protected]> wrote: > You're right, that works. Thanks! > > But may I ask _why_ it works? Consider: > > uint x = -int.min; > > My first guess would be that the result of the negation is an int as > well (and therefore == int.min), and that the cast to uint doesn't > happen until the assignment. Apparently this isn't the case.
-int.min is actually an unsigned result, that's why it wraps. Casting it to uint unwraps it. _______________________________________________ phobos mailing list [email protected] http://lists.puremagic.com/mailman/listinfo/phobos
