This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: std::max: if versus ?:


On 09/20/2012 02:24 PM, Marc Glisse wrote:
When a and b have possibly different types, using "if" makes a lot of sense (I even advocated replacing ?: with "if" somewhere in the gcc codebase in PR50177). Inside std::max, a and b both have exactly the same type const _Tp&, so it shouldn't matter.

Note that libcxx uses ?: for its implementation of std::max.

I assume there are historical reasons, some compilers had bugs in their ?: support or produced slightly faster code with "if"...

Good, good, consider a patch pre-approved ;)

Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]