why bother with operator precedence

Bill Poser poser at csli.Stanford.EDU
Tue Mar 27 09:21:50 AEST 1990


Insisting that students use minimal parenthesization will help them
to learn the precedence rules, but why bother? Students should of
course be familiar with the concept and with some very elementary
rules so that they will know what is going on when they read other people's
unparenthesized code, but it seems quite pointless to me to learn the
precedence table in detail. It is unnecessary, since you can always
parenthesize, it is tedious in a language like C with lots of operators
and precedence levels, and it is error prone, both in that it is easy
to make mistakes if one relies heavily on precedence and in that it
produces dangerous bad habits that don't port readily between languages.
Parenthesization (combined with line breaks and indentation) does a much
better job of displaying the structure of expressions.

So, why bother with precedence?



More information about the Comp.lang.c mailing list