From: pvanbell@cloud9.net (Paul Van Bellinghen)
Subject: Re: assignments using different types
Date: 1997/01/29
Date: 1997-01-29T00:00:00+00:00 [thread overview]
Message-ID: <32eeaf02.9413191@NEWS.CLOUD9.NET> (raw)
In-Reply-To: 32EE4431.6D24@ti.com
why are you re-casting variables that are already in the proper cast.
The only time you need to re-cast a variable into float is when the
variable is an integer.
On Tue, 28 Jan 1997 12:23:45 -0600, David Dessert <d-dessert@ti.com>
wrote:
>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.
next prev parent reply other threads:[~1997-01-29 0:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-01-28 0:00 assignments using different types David Dessert
1997-01-28 0:00 ` 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 [this message]
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