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.9 required=5.0 tests=BAYES_00 autolearn=ham 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-02-07 12:59:39 PST Newsgroups: comp.lang.ada Path: swrinde!ihnp4.ucsd.edu!newshub.nosc.mil!news!sampson From: sampson@nosc.mil (Charles H. Sampson) Subject: Re: "Subtract C, add Ada" Message-ID: <1995Feb1.164513.23467@nosc.mil> Sender: news@nosc.mil Organization: Computer Sciences Corporation References: <3gl06i$s03@miranda.gmrc.gecm.com> Date: Wed, 1 Feb 1995 16:45:13 GMT Date: 1995-02-01T16:45:13+00:00 List-Id: In article <3gl06i$s03@miranda.gmrc.gecm.com>, R.A.L Williams wrote: >In article <1995Jan23.154631.6702@sei.cmu.edu> you(?) wrote: >: >: Again, I don't see it. The Ada code makes it clear that *corresponding* >: elements of the array Q are being copied into P - though, of course, >: a real Ada programmer (TM) would have written just P := Q. The C code >: doesn't make that clear - you're going to have to ferret out the >: initialisations of p and q to determine that. And if you worry about >: the correctness of the copy - for instance, whether P and Q are the >: same size - that's surely going to be a lot easier to establish in Ada. > >Again, a simplified example to illustrate a principle. The point is that >the less I have to move my eyes, or flip over pages, when reading/reviewing ^^^ ^^^^ ^ ^^^^ ^^ ^^^^ ^^ ^^^^ ^^ ^^^^ ^^^^ ^^^^^ >code, the more likely I am to understand it and find any bugs. You're >quite right, P := Q is an event more compact representation and I approve >(the Bill Williams official statement of approval!). The marked phrases are what many of us Ada fans are talking about when we use the word _readability_. P := Q unambiguously shows that the value of Q is being assigned to P. To repeat you's statement, *p++ = *q++ simply says that whatever q was pointing to gets copied to whatever p is pointing to, after which both are modified to point to the "next" thing. Depending on the complexity of the code, it can take a tremendous amount of ferreting about, moving eyes and flipping pages, to discover what p and q are pointing to. Charlie