comp.lang.ada
 help / color / mirror / Atom feed
From: Rex Reges <Dogbert.EggsAndSpamWithoutTheSpam@reges.org>
Subject: Re: Joint Strike Fighter
Date: Thu, 8 Nov 2001 14:55:41 GMT
Date: 2001-11-08T14:55:41+00:00	[thread overview]
Message-ID: <3BEA9CED.8C6BF839@reges.org> (raw)
In-Reply-To: 3BE853FD.513040F@reges.org



Larry Kilgallen wrote:
> 
> In article <3BE853FD.513040F@reges.org>, Rex Reges <Dogbert.EggsAndSpamWithoutTheSpam@reges.org> writes:
> 
> > Upon this conclusion, I can now make sense of the Ada coding
> > practices I've seen:
> 
> >  - Assigning all of the components of a record one at
> >    a time instead of using an aggregate assignment.
> 
> It must be done separately if your design involves making
> two successive assignments to the same component and none
> to some other component.
> 

When reading code where every assignment is done on primitive
components throughout, I find this reminiscent of writing a
C program since C doesn't have an assignment operator for
things like structures and arrays. Tedious, eh? You can use 
memmov, of course, but that has all sorts of dangers of its
own.

Generally, it is a good idea to make an aggregate assignment
for a record, since any change in the record type will then
cause a compiler error if some part of the code is not
updated. I'm sure you are not suggesting that we eliminate
this guideline, but rather allow exceptions.  I've ran into
a few myself:

  - Some structures are too big to even initialize with an
    aggregate assignment (a 128kB memory mapped device control 
    areas, for example).

  - When frequently appending to the same variable structure  
    by  modifying the variant part is inefficient; it's better 
    to expand the variable to the max expected size once, 
    filling it with dummy data, and then overwrite the 
    individual subcomponents one at a time.

  - If there is the possibility that a subcomponent is 
    out of range, then you need individual assignments of
    the subcomponents to perform a constraint check. The 
    constraint check is only required for the assignment 
    operator and the constraint checks for a record assignment 
    are only to verify the variant parts are in range. I've 
    seen this happen when an ASCII string (Ada83) was read in 
    with 8-bit characters in it (someone used the compose key to 
    create a degree symbol). Another time, a floating point 
    conversion routine didn't catch that the exponent was greater 
    than the 255 max value since I set the entire floating point 
    structure in a single aggregate assignment.

I certainly can't disagree with you over this point!

Rex Reges



  parent reply	other threads:[~2001-11-08 14:55 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-29  4:55 Joint Strike Fighter Richard Riehle
2001-10-29 11:11 ` Ian
2001-10-31  6:38   ` Richard Riehle
2001-10-31 13:38     ` David Botton
2001-10-31 16:15     ` Wes Groleau
2001-10-31 16:25       ` Marin David Condic
2001-11-01  4:44         ` JF Harrison
2001-11-01 14:41           ` Marin David Condic
2001-11-03 16:58             ` Richard Riehle
2001-11-03 18:52               ` Jeffrey Carter
2001-11-05 15:30                 ` Ted Dennison
2001-11-06  2:07                   ` Jeffrey Carter
2001-11-06 16:46                   ` Rex Reges
2001-11-06 18:17                     ` Marin David Condic
2001-11-06 19:07                     ` Larry Kilgallen
2001-11-06 21:19                       ` Rex Reges
2001-11-06 23:01                         ` Larry Kilgallen
2001-11-08 14:55                         ` Rex Reges [this message]
     [not found]                         ` <Wa+tfCvHgQXH@eisner.e <3BEA9CED.8C6BF839@reges.org>
2001-11-08 15:43                           ` Ian Wild
2001-11-08 22:18                             ` Rex Reges
2001-11-22  6:25                               ` David Thompson
2001-11-08 16:23                         ` Larry Kilgallen
2001-11-08 13:53                     ` Marc A. Criley
2001-11-08 22:15                       ` Rex Reges
2001-11-09 12:44                         ` Marc A. Criley
2001-11-09 15:41                           ` Ted Dennison
2001-11-09 15:35                     ` Ted Dennison
2001-11-10  6:56                       ` john flynn
2001-11-04  1:08               ` David Botton
2001-11-05 14:59               ` Marin David Condic
2001-11-01 14:55           ` Ted Dennison
2001-11-01 21:47           ` P Norby
2001-11-02 17:02           ` P Norby
     [not found]           ` <003301c163c0$289f8c60$45d82c41@vaio>
2001-11-02 19:54             ` JF Harrison
     [not found]             ` <002a01c163d8$25bb4440$2702a8c0@WorkGroup>
2001-11-02 20:40               ` JF Harrison
2001-11-01 11:38         ` Ian
2001-11-01 14:51           ` Marin David Condic
2001-11-02  9:08           ` John McCabe
2001-11-02 16:16             ` Ian
2001-11-02 17:04               ` John McCabe
2001-11-29 16:48           ` Matthew Heaney
2001-11-29 17:12             ` Marin David Condic
2001-11-30 12:49               ` Simon Wright
2001-11-30 14:46                 ` Marin David Condic
2001-11-30 16:37                   ` Jeffrey Carter
2001-11-30 15:03                 ` Ted Dennison
2001-11-30 16:26                   ` Simon Wright
2001-11-30 16:39                     ` Ted Dennison
2001-11-30 17:08                     ` Pat Rogers
2001-11-30 22:53                     ` Chad R. Meiners
2001-12-01  8:08                       ` Simon Wright
2001-10-29 15:02 ` Marin David Condic
2001-10-29 17:55 ` Paul A Storm
2001-11-01  4:46   ` Richard Riehle
2001-11-02 20:03 ` Dirk Craeynest
2001-11-07  3:57 ` Vincent Marciante
replies disabled

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