C style peeve and knowing the rules
News system
news at ism780c.isc.com
Tue Mar 27 13:18:15 AEST 1990
In article <19356 at megaron.cs.arizona.edu> robert at 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.
I would hope you don't fault your students for writing:
x = a << (i+j);
Here is what Dennis Ritchie says in "The C programming Language, The Bell
System Technical Journal, July-August 1978" under the heading "Unfavorable
experiences":
There are some occasionally suprising operator precedences. For
example a >> 4 + 5 shifts right by 9.
Marv Rubinstein
More information about the Comp.lang.c
mailing list