comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@bix.com
Subject: Re: assignments using different types
Date: 1997/01/29
Date: 1997-01-29T00:00:00+00:00	[thread overview]
Message-ID: <5co1nu$h35@news2.delphi.com> (raw)


>   Velocity := Velocity_Type(float(Distance) / float(Time));
>Can anyone provide me with suggestions to improve the readability
>of the above assignment?  Of course, I'd like efficiency to be

  How about creating

function "/"(Distance : in Distance_Type;
             Time     : in Time_Type)
return Velocity_Type is
begin
  return Velocity_Type(float(Distance) / float(Time));
end "/";

  and then you will be able to write

Velocity := Distance / Time;

(Actually, your current statement is quite readable - though tedious
to write.)




             reply	other threads:[~1997-01-29  0:00 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-29  0:00 tmoran [this message]
  -- strict thread matches above, loose matches on Subject: below --
1997-01-30  0:00 assignments using different types Thomas
1997-01-28  0:00 David Dessert
1997-01-28  0:00 ` Christopher Green
1997-01-29  0:00 ` Paul Van Bellinghen
1997-02-10  0:00   ` Robert Dewar
1997-01-29  0:00 ` Robert I. Eachus
1997-01-29  0:00 ` Robert Dewar
1997-01-29  0:00 ` 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