From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-1.9 required=3.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.5-pre1 Date: 23 Jun 93 20:44:44 GMT From: cis.ohio-state.edu!math.ohio-state.edu!uwm.edu!ogicse!netnews.nwnet.net!n ews.u.washington.edu!stein2.u.washington.edu!bketcham@ucbvax.Berkeley.EDU (Ben jamin Ketcham) Subject: Re: Software vendors not using Ada but C Message-ID: <20afbsINN6or@news.u.washington.edu> List-Id: In article <1993Jun23.190753.8583@aio.jsc.nasa.gov> yow@pat.mdc.com (Bill Yow) writes: >In article <9306221230.AA05804@sed00.sed>, mking@FSD.COM (Mike King) writes: [stuff related to c=a+++b;] >Well, when I was in school the C class I took (in 86) the professor would not >allow us to use (). The reason, he felt that a good C programmer should not >need to use () but should know all of the precedence rules. In fact he would >take off points on test for the use of (). So there are at least 30 C >programmers who had it drilled into there heads not to use (). > >And this was not a small school either, the engineer school had over 5,000 >students and the entire school was over 20,000. If you say so, but it seems highly unlikely that anyone would take the parenthesis-minimization aesthetic to such extremes as to claim that c=a+++b; is a good thing to write. I could believe that your professor frowned on such things as result=(condition1||(condition2||(condition3||condition4))); because in cases like this, the parenthesis are nothing but noise and ruin an otherwise clear and readable statement. And even in cases like result=((condition5&&condition6)||(condition7&&condition8)); or result=((integer1*integer2)+(integer3*integer4)); I would argue that the parenthesis render the expression *less* readable, and that (IMHO) everyone ought to know which of && and || or * and + (see, no parens needed for that to make sense, right?) has the higher precedence. Of course, logical use of whitespace can be very helpful, so I might write result = condition5&&condition6 || condition7&&condition8 ; or result = integer1*integer2 + integer3*integer4 ; I don't claim that everyone has to think my way about this, but I can certainly see why a professor would want to discourage the use of extraneous parenthesis in cases like these. Furthermore, forbidding the use of () might temporarily (with appropriate explanation and with "debriefing" afterwards) serve as a good exercise in learning the precedence rules. Anyone who would argue against parens in c=a+++b; is a fool, though. Are you *sure* your professor was *this* dogmatic about it? --ben (Yes, I know this has nothing to do with Ada)