Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!samsung!think!barmar From: barmar@think.com (Barry Margolin) Newsgroups: comp.lang.c Subject: Re: C style peeve and knowing the rules Message-ID: <35039@news.Think.COM> Date: 27 Mar 90 06:08:03 GMT References: <2205@osc.COM> <340018@hplvli.HP.COM> <19356@megaron.cs.arizona.edu> <689@sagpd1.UUCP> Sender: news@Think.COM Reply-To: barmar@nugodot.think.com.UUCP (Barry Margolin) Organization: Thinking Machines Corporation, Cambridge MA, USA Lines: 24 In article <689@sagpd1.UUCP> jharkins@sagpd1.UUCP (Jim Harkins) writes: >In article <19356@megaron.cs.arizona.edu> robert@cs.arizona.edu (Robert J. Drabek) writes: >>I require my students to use the absolute minimum number of parenthesis >>until they have ALL the rules down pat. >My God I hope I never ever run into one of your students. Pray tell, what >does > x = *a->b++ + ++z / 3 << 9^6 + 3 >> 2 ^ 5 <= 98 *~ c % d--; That expression has problems, but adding parentheses would hardly solve them. I don't think I'd understand it unless it were broken up into multiple assignment statements, with mnemonic variable names for the temporaries. Alternatively, comments would be nice, and if they were good they would serve as well as mnemonic variables and parentheses. Presumably the author of such a statement originally developed it in a stepwise fashion, which would be mirrored by the multiple statement version. Then he merged them into one statement for performance reasons, and then removed parens for some perverted reason. The comments I mentioned above could just be the original multiple statements! -- Barry Margolin, Thinking Machines Corp. barmar@think.com {uunet,harvard}!think!barmar