comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon.j.wright@amsjv.com>
Subject: Re: School Assignment--Can this be simplified?
Date: 31 Aug 2000 12:31:58 +0100
Date: 2000-08-31T12:31:58+01:00	[thread overview]
Message-ID: <x7v66ohis41.fsf@galadriel.frlngtn.gecm.com> (raw)
In-Reply-To: 39AE0E2A.C11F53F4@baesystems.com

Martin Dowie <martin.dowie@baesystems.com> writes:

> 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;)

Agreed in principle, but I don't think that 273.15 is a 'factor'
precisely :-)

We have just spent several minutes discussing a suitable name; one
suggestion was on the lines of Zero_Celsius_In_Kelvins.

  procedure P (Temperature : Float);
  -- Temperature is in Kelvins

  C : Float;
  -- in Celsius

  ...

  P (Temperature => C + Zero_Celsius_In_Kelvins);

which is pretty icky. Perhaps derived or even private types would be
interesting. Perhaps just conversion functions, inline if you like?

  function To_Kelvins (Temperature_In_Celsius : Float) return Float;

-- 
Simon Wright                         Email: simon.j.wright@amsjv.com
Alenia Marconi Systems                     Voice: +44(0)23 9270 1778
Integrated Systems Division                  FAX: +44(0)23 9270 1800



  reply	other threads:[~2000-08-31 11:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-08-30  0:00 School Assignment--Can this be simplified? N J Chackowsky
2000-08-30  0:00 ` Pascal Obry
2000-08-30  0:00 ` tmoran
2000-08-30  0:00 ` Keith Thompson
2000-08-31  0:00 ` Martin Dowie
2000-08-31 11:31   ` Simon Wright [this message]
2000-08-31 11:51     ` Martin Dowie
2000-08-31 18:35   ` N J Chackowsky
2000-08-31 19:19     ` N J Chackowsky
2000-08-31 19:33       ` Pascal Obry
2000-08-31 23:03         ` Nick J Chackowsky
2000-09-01  1:02         ` tmoran
2000-09-01  4:14           ` Robert Dewar
2000-09-01 17:51             ` tmoran
2000-09-02  3:12               ` Robert Dewar
replies disabled

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