Path: utzoo!utgpu!news-server.csri.toronto.edu!clyde.concordia.ca!uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!rpi!leah!bingvaxu!cjoslyn From: cjoslyn@bingvaxu.cc.binghamton.edu (Cliff Joslyn) Newsgroups: comp.lang.c Subject: Re: why bother with operator precedence Message-ID: <3224@bingvaxu.cc.binghamton.edu> Date: 28 Mar 90 02:38:27 GMT References: <2205@osc.COM> <340018@hplvli.HP.COM> <19356@megaron.cs.arizona.edu> <1379@ux.acs.umn.edu> <2031@l.cc.purdue.edu> <15289@bfmny0.UU.NET> Reply-To: cjoslyn@bingvaxu.cc.binghamton.edu.cc.binghamton.edu (Cliff Joslyn) Organization: SUNY Binghamton, NY Lines: 16 Since operator precedence in C is relatively arbitrary and there are *many* operators, I let my students use an operator chart on exams (along with an ASCII chart and other similar collections of detailed information that no one should need to memorize). Then I might give them one of the monster expressions we've seen and ask them to provide a parsing, along with an evalution of the type, size, and value of each sub-expression. In code, I criticize both over-parenthesization and under-parenthesization as I see fit. This seems to accomplish both ends of teaching precedence while not being dogmatic about it. -- O-------------------------------------------------------------------------> | Cliff Joslyn, Cybernetician at Large, cjoslyn@bingvaxu.cc.binghamton.edu | Systems Science, SUNY Binghamton, Box 1070, Binghamton NY 13901, USA V All the world is biscuit shaped. . .