Reply to post:

Linus Torvalds admits to 'self-inflicted damage' with -Werror as Linux 5.15 rc1 debuts

Anonymous Coward
Anonymous Coward

You should never assume operator precedence. It varies between languages. Even if you know it, the people maintaining your code in the future might not know it. Or they they might not know that you know it. In the interests of readable code, always insert extra parentheses to make it clear what you are intending.

ie.

if ((value < lower_limit) || (value > upper_limit))

is more readable than

if (value < lower_limit || value > upper_limit)

Even though they compile to the same code

Just try writing the second form in Delphi/Pascal and you will come unstuck.

POST COMMENT House rules

Not a member of The Register? Create a new account here.

  • Enter your comment

  • Add an icon

Anonymous cowards cannot choose their icon