From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1d321b3a6b8bcab2 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 1995-01-21 07:18:00 PST Path: nntp.gmd.de!newsserver.jvnc.net!nntpserver.pppl.gov!princeton!udel!gatech!bloom-beacon.mit.edu!panix!cmcl2!thecourier.cims.nyu.edu!thecourier.cims.nyu.edu!nobody From: dewar@cs.nyu.edu (Robert Dewar) Newsgroups: comp.lang.ada Subject: Re: "Subtract C, add Ada" Date: 21 Jan 1995 10:18:00 -0500 Organization: Courant Institute of Mathematical Sciences Message-ID: <3fr8j8$r8h@gnat.cs.nyu.edu> References: <3fo2ot$su2@miranda.gmrc.gecm.com> Date: 1995-01-21T10:18:00-05:00 List-Id: Laurent Gasser says: >"Personally, the lack of this sort of compactness in Ada, and things like > pre- and post-increment/decrement are one of my minor gripes about the > language. OK, its no big thing to write: > > P(I) := Q(I); > I := I + 1; > > instead of > > *p++ = *q++; > > but I actually *do* find the C representation easier/better etc. (perhaps > I'm wierd?)" The trouble with these notations in C is that they work better with short variable names, as in the example above. This is reminiscent of typical mathematical notations (like ! for factorial) that also are predicated on typical mathematical style of one character variables like x. Now look at Next_Predicted_Value (Iteration_Index) := Previous_Calculated_Value (Iteration_Index); and *Next_Predicted_Value++ = *Previous_Calculated_Value++; There are two problems with the second form. First the * and ++ seem to get a bit lost with the long names. Second, we are missing the name Iteration_Index which may be quite helpful in understanding what is going on. Note also that the C style is implying the use of pointers, which are less comfortable than the use of arrays, because the pointers could be pointing to anything, while we know what is involved with the arrays. All in all, the Ada in the second example seems much clearer, and of course once you use long identifiers, the advantage of the compact notation is reduced. There is no rule saying use long identifiers in Ada, and use short identifiers in C (and I am sure we have all seen code with short identifiers in Ada, and long identifiers in C), but it is not an accident that even though there are no rules, there are effectively stylistic customs in these directions, and I think that the neat compact C syntax gizmos are at least partly responsible.