Once, I was arguing about operator precedence in C++ with my colleague. He was very confident about the precedence of one particular operator—I don’t remember exactly which one, but I think it was || versus &&. He claimed he could see the precedence clearly in his mind because he had printed a table, put it on the wall, and memorized it.

We decided to check online, and it turned out he was wrong, which left him very confused. As it turned out, the printout on his wall was incorrect. For a long time, if you Googled “C++ operator precedence,” the first link provided by Google led to a table that contained a mistake. I actually emailed the professor who had published the table to have it corrected.

Next - Previous