Path: utzoo!attcan!uunet!decwrl!shelby!csli!poser From: poser@csli.Stanford.EDU (Bill Poser) Newsgroups: comp.lang.c Subject: why bother with operator precedence Message-ID: <12845@csli.Stanford.EDU> Date: 26 Mar 90 23:21:50 GMT References: <2205@osc.COM> <340018@hplvli.HP.COM> <19356@megaron.cs.arizona.edu> <894@dino.cs.iastate.edu> <2677@sunquest.UUCP> Sender: poser@csli.Stanford.EDU (Bill Poser) Reply-To: poser@csli.stanford.edu (Bill Poser) Organization: Center for the Study of Language and Information, Stanford U. Lines: 14 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?