std::max: if versus ?:
Chris Jefferson
chris@bubblescope.net
Sun Sep 23 18:54:00 GMT 2012
On 23/09/12 17:39, Marc Glisse wrote:
> On Sun, 23 Sep 2012, Gabriel Dos Reis wrote:
>
>> I think I have a preference for reverting the patch.
>
> I don't mind, but could you explain what makes you prefer:
> if (__a < __b)
> return __b;
> return __a;
> to:
> return __a < __b ? __b : __a;
> ?
One reason is that (as you have shown) patches like this can have very
subtle consequences. I'm sure people are using max in all kinds of ways
you can't imagine, so unless we are 100% sure the changed version has
advantages, it's probably safer to leave it as is.
Chris
More information about the Libstdc++
mailing list