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.7 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_REPLYTO,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ba9a717d172afa4f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2000-08-31 11:33:21 PST Path: supernews.google.com!sn-xit-02!sn-xit-03!supernews.com!news.gv.tsc.tdk.com!falcon.america.net!sunqbc.risq.qc.ca!torn!canopus.cc.umanitoba.ca!news-in.mts.net!news2.mts.net.POSTED!not-for-mail Message-ID: <39AEAE34.4E9753C8@brandonsd.mb.ca> From: N J Chackowsky Reply-To: nick@arcticmail.com X-Mailer: Mozilla 4.7 [en] (Win95; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: School Assignment--Can this be simplified? References: <39AD5DBD.972C97CA@brandonsd.mb.ca> <39AE0E2A.C11F53F4@baesystems.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Thu, 31 Aug 2000 18:35:23 GMT NNTP-Posting-Host: 206.45.76.50 X-Complaints-To: admin@mts.net X-Trace: news2.mts.net 967746923 206.45.76.50 (Thu, 31 Aug 2000 13:35:23 CDT) NNTP-Posting-Date: Thu, 31 Aug 2000 13:35:23 CDT Organization: MTS Internet Xref: supernews.google.com comp.lang.ada:440 Date: 2000-08-31T18:35:23+00:00 List-Id: Thanks for the advice/warnings/etc. I think that where I'm getting myself confused is with which libraries are standard and which aren't. I had *thought* that any ada.* were standard. The text I'm using (Feldman) doesn't make this clear. I've started to plow through the reference manual, looking for the functions available in ...generics_elementary_functions. The reason I was using such a mix of "magic numbers", constants, and variables, was to "code around" the multiple data types, as a result of using ada.numerics.aux (based on double). As I get to know the libraries better, I'll tidy up my code. (Using gnat-3_13p-nt.exe on Win95/98.) One problem that smote my eyes *just* after making the post was, of course, that the calculation can be vastly simplified. Since it takes the form x a (x-y) ---- which is a . Not really an Ada95-specific issue, though. y a Again, thanks for the responses. Nick J Chackowsky Brandon, MB Martin Dowie wrote: > > A little more detail about what compile suite you are using might be > helpful... > > What is 'ada.numerics.aux' - it isn't a standard library unit? > Why not use an instance of 'Ada.Numerics.Generic_Elementary_Functions', > which is the standard library generic for maths functions? (some > implementations provide 'ready-to-use' instances for float/long_float). > > On the programming style front (feel free to ignore the rest of this > response ;-) > > 1. 'magic numbers' (e.g. 273.15) are repeated and would be more > readable as named numbers (e.g. c_to_k_factor : constant := 273.15;) > > 2. Why are all the data objects 'variables' that are only ever assigned > once? This is a little pet-hate of mine, as by declaring them as > constants would help reduce target code size on some (most?) > compilers. I was always taught it is simply 'better programming'. > > It is a current loathing of mine simply because we are using > a non-optimizing compiler just now; 3 out of the original 5 s/w > engineers have left and their stuff is litter with this and, hey, > guess what, we're short on space on the target! If they had used > constants like this we would have an extra couple of percent - > not much, but for a little thought when programming, it is a couple > of percent we wouldn't have to be scrapping together now! As a side > effect, by reducing code size we increase throughput on the target > too :-) > > 3. I best not even get into the whole 'why is everything a 'float' and > not user-defined float types' thing... This smacks of 'C' programs > not Ada programs. > > N J Chackowsky wrote: > > > [snip] > > > -- > The views expressed here are personal and not those of BAE Systems.