
"David Abrahams" <dave@boost-consulting.com> wrote in message news:u7jtf3hxn.fsf@boost-consulting.com...
IMO it's only a valid coding standard if you also have a coding standard that says "operators must always act the same on user-defined types as they do on the builtins" -- which I would never accept ;-)
Probably the right standard is:
"If you're trying to define operators that act like the builtin ones, beware the overloading of operator,, operator&& and operator||, because you can't get identical semantics".
But then, why would anyone want to overload operator, other than to change the semantics??
That argument doesn't hold water. You do want to change the semantics, but not in ways that can be confusing or introduce subtle nonportabilities. Unlike all other overloadable operators, the three operators you mention have special regime in the way they evaluate their arguments, regime that cannot be emulated with regular function calls. That being said, I take it your answer was (a): it is an obsolete coding standard. Thanks. Any other votes and opinions are welcome. Andrei