comp.lang.ada
 help / color / mirror / Atom feed
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
Date: 23 Jun 93 20:44:44 GMT	[thread overview]
Message-ID: <20afbsINN6or@news.u.washington.edu> (raw)

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)

             reply	other threads:[~1993-06-23 20:44 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1993-06-23 20:44 cis.ohio-state.edu!math.ohio-state.edu!uwm.edu!ogicse!netnews.nwnet.net!n [this message]
  -- strict thread matches above, loose matches on Subject: below --
1993-06-27 12:38 Software vendors not using Ada but C David Weller
1993-06-25 23:39 Mark Bayern
1993-06-24  6:05 ghost.dsi.unimi.it!univ-lyon1.fr!scsing.switch.ch!epflnews!disuns2.epfl.c
1993-06-23 22:10 Michael Feldman
1993-06-23 20:33 Robert Firth
1993-06-23 19:07 Bill Yow
1993-06-22 15:33 agate!howland.reston.ans.net!math.ohio-state.edu!sdd.hp.com!col.hp.com!cs
1993-06-22 12:30 Mike King
1993-06-22  6:50 cis.ohio-state.edu!magnus.acs.ohio-state.edu!math.ohio-state.edu!cs.utexa
1993-06-18 14:19 Colin James 0621
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox