BigInt bool assign

Derek ddparnell at bigpond.com
Sat Dec 24 07:18:18 PST 2011


On Sat, 24 Dec 2011 21:33:33 +1100, Don <nospam at nospam.com> wrote:

> I think stuff like
> int z +=  x > y;
> should ideally require a cast. That's a crazy operation.

I would go so fas as saying that such an idiom ought to be coded as ...

   if (x > y) {
      z++;
   }

or if insists on a one-liner ...

   z += (x > y ? 1 : 0);

-- 
Derek Parnell
Melbourne, Australia


More information about the Digitalmars-d mailing list