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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,751584f55705ddb7 X-Google-Attributes: gid103376,public From: geert@fozzie.sun3.iaf.nl (Geert Bosch) Subject: Re: Side-effect arithmetic again [was: Ada ... in embedded systems] Date: 1996/03/21 Message-ID: <4iq4k7$1p6@fozzie.sun3.iaf.nl>#1/1 X-Deja-AN: 143675379 references: <314B33CE.64EE@escmail.orl.mmc.com> organization: La Calandre Infortunee newsgroups: comp.lang.ada Date: 1996-03-21T00:00:00+00:00 List-Id: Robert I. Eachus (eachus@spectre.mitre.org) wrote: : (Should the function form be named something other than Inc and : Dec? Does the Ada domain specific knowledge that the parameters of : a function are not changed dominate here, or should it be named Next?) The terms increment and decrement suggest an update of the parameter, so I think these terms are good. Something like Next(T) sounds more like a function. Also when speaking about these operations everybody talks about incrementing and decrementing variables, so I see no justification for using other terms. One point would be whether to use the long or the short name. I'd vote for the long version. I don't see the huge win in saving those 6 keystrokes. I find that I can read the word Decrement as fast as Dec. For people who are not guilty of having used assembly-language the long variant will definately be easier to understand. So, I think the best readable variant is to use Increment and Decrement. When I helped people with their initial programming course (using Turbo Pascal) I found that for most people Inc(x) and Dec(x) were not clear: they often asked what those functions did or looked them up in the library. Once they knew the new secret function they used it all over the place, because Inc(A[I]) would be much faster than A[I] := A[I] + 1; Most of them were very disappointed when I showed them that both forms generated identical code. There must be some reason that people want to write Inc(I); or I++; instead of I := I + 1; or Increment(I); BTW: I really, really miss those mixed assembly/Pascal listings in which the assembly used the right symbolic names for both globals and locals. Greetings, Geert -- E-Mail: geert@sun3.iaf.nl *** Lbh whfg penpxrq ZvpebFbsg'f *** Phone: +31-53-4303054 ** arj naq vzcebirq frphevgl flfgrz. **