comp.lang.ada
 help / color / mirror / Atom feed
* assignments using different types
@ 1997-01-28  0:00 David Dessert
  1997-01-28  0:00 ` Christopher Green
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: David Dessert @ 1997-01-28  0:00 UTC (permalink / 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.




^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~1997-02-10  0:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-01-28  0:00 assignments using different types 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
1997-01-30  0:00   ` inter-unit inlining (was: Re: assignments using different types) Fergus Henderson

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