This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

difficult question

what is th eorder of presedents?

is 2 + 3 * 5 = 32 or 17

Parents
  • That sounds a bit too hard. The compiler do know the precendence rules, and the developer should know them too or have the access to the source code revoked.

    Parentheses may be good for making the code faster to read in some situations, but I would not add parentheses for a three-argument equation with one add and one multiplication. No developer should need the parentheses for the readability.

    But while parentheses may help with readability, too much parentheses makes the expression harder to read, forcing me to put the cursor on a parentesis just to see where the matching parenthesis is.

Reply
  • That sounds a bit too hard. The compiler do know the precendence rules, and the developer should know them too or have the access to the source code revoked.

    Parentheses may be good for making the code faster to read in some situations, but I would not add parentheses for a three-argument equation with one add and one multiplication. No developer should need the parentheses for the readability.

    But while parentheses may help with readability, too much parentheses makes the expression harder to read, forcing me to put the cursor on a parentesis just to see where the matching parenthesis is.

Children
No data