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,2def9aa85afa5d22 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-11-08 08:23:37 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!headwall.stanford.edu!hub1.nntpserver.com!news-out.spamkiller.net!propagator-la!news-in-la.newsfeeds.com!newsfeed.onecall.net!chcgil2-snf1.gtei.net!news.gtei.net!news.binc.net!kilgallen From: Kilgallen@SpamCop.net (Larry Kilgallen) Newsgroups: comp.lang.ada Subject: Re: Joint Strike Fighter Date: 8 Nov 2001 10:23:29 -0600 Organization: Berbee Information Networks Corporation Message-ID: References: <3BDCE159.39F6D422@adaworks.com> <11bf7180.0110290311.4d8d6f04@posting.google.com> <3BDF9C6A.C25520C5@adaworks.com> <3BE023AB.8F235EF5@sparc01.ftw.rsc.raytheon.com> <9rp8mo$6d8$1@nh.pace.co.uk> <9rrmvl$98d$1@nh.pace.co.uk> <3BE4221B.34589071@adaworks.com> <3BE43CDC.F6B1EE30@acm.org> <3BE813E4.C4797DDE@reges.org> <3BE853FD.513040F@reges.org> In article <3BEA9CED.8C6BF839@reges.org>, Rex Reges writes: > Larry Kilgallen wrote: >> >> In article <3BE853FD.513040F@reges.org>, Rex Reges 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. > 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 Actually I was not even exceptions. I merely made another (failed) attempt at an implicit ":-)". When will I learn :-) > 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). That seems like a compiler limitation, which ultimately should be corrected. > - 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. There must be a way compilers could do that better. Granted I generally don't do speed-critical work, but I prefer something that is more foolproof even if slightly slower. > - 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 I would have guessed creation of the record aggregate would have done constraint checking. I gather my guess would have been wrong.