On Fri, 15 Feb 2013 17:49:53 -0500, monarch_dodra <monarchdo...@gmail.com>
wrote:
On Friday, 15 February 2013 at 22:06:55 UTC, Steven Schveighoffer wrote:
With opcmp:
int opCmp(int a, int b)
{
return a - b;
}
Genius!
Now I feel bad for every time I've done integral opCmp with double
ternary operators :(
Actually, I'm not as smart as you think ;)
There needs to be some extra checking, possibly with the carry flag.
For example:
0x70000000 - (-0x70000000)
would be less than zero as a resulting integer.
But it would work with shorts or bytes!
In any case, the example was bad, the point that which is better depends
on the situation is still correct.
-Steve