comp.lang.ada
 help / color / mirror / Atom feed
From: David Dessert <d-dessert@ti.com>
Subject: assignments using different types
Date: 1997/01/28
Date: 1997-01-28T00:00:00+00:00	[thread overview]
Message-ID: <32EE4431.6D24@ti.com> (raw)


I have a question about readability and efficiency of assignments
when using strict types in Ada83.  I'm using the TI-Tartan C40
compiler, which has few Ada95 features.

Example:
   type Distance_Type is new float range 0.0 .. 1000.0;
   type Time_Type is new float range 0.0 .. 10.0;
   type Velocity_Type is new float;

   Distance : Distance_Type := 100.0;
   Time     : Time_Type     := 10.0;
   Velocity : Velocity_Type;

...

   -- A difficult to read, but legal Ada assignment.
   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
similar to that of using the same type for all the variables.




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

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-01-28  0:00 David Dessert [this message]
1997-01-28  0:00 ` assignments using different types Christopher Green
1997-01-29  0:00 ` Robert Dewar
1997-01-30  0:00   ` inter-unit inlining (was: Re: assignments using different types) Fergus Henderson
1997-01-29  0:00 ` assignments using different types Robert Dewar
1997-01-29  0:00 ` Robert I. Eachus
1997-01-29  0:00 ` Paul Van Bellinghen
1997-02-10  0:00   ` Robert Dewar
  -- strict thread matches above, loose matches on Subject: below --
1997-01-29  0:00 tmoran
1997-01-30  0:00 Thomas
replies disabled

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