Benjamin Kaplan wrote:
On Fri, Aug 14, 2009 at 12:42 PM, Douglas Alan <darkwate...@gmail.com>wrote:

P.S. Overloading "left shift" to mean "output" does indeed seem a bit
sketchy, but in 15 years of C++ programming, I've never seen it cause
any confusion or bugs.



The only reason it hasn't is because people use it in "Hello World". I bet
some newbie C++ programmers get confused the first time they see << used to
shift.

Actually, I've seen it cause confusion, because of operator precedence. The logical shift operators have a fairly high level priority, so sometimes you need parentheses that aren't obvious. Fortunately, most of those cases make compile errors.


C++ has about 17 levels of precedence, plus some confusing associative rules. And operator overloading does *NOT* change precedence.

DaveA

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to