comp.lang.ada
 help / color / mirror / Atom feed
From: ucaa2385@iris3.csv.ica.uni-stuttgart.de (Peter Hermann)
Subject: Re: Q: common types?!
Date: 29 Sep 1994 11:37:11 GMT
Date: 1994-09-29T11:37:11+00:00	[thread overview]
Message-ID: <36e8t7$19ql@info2.rus.uni-stuttgart.de> (raw)
In-Reply-To: 36c1c0$lve@pong.lasc.lockheed.com

Tony Leavitt (tony@deepthought.Sgi.COM) wrote:
: This package would define all kinds of types for feet, nautical
: miles, degrees, radians, etc, ad nuasium, for all different kinds and sizes
: of float and integers.  Am I about to go insane by trying this?  Or, does

yes

:    type float64 is new float ;
:    for  float64'SIZE use 64 ;

The type float has been introduced as a predefined type which is 
different for each compiler/hardware and cannot be used
for portable programs. Coming from other languages without typing
system, the type float is offered in Ada for a first, unclean
solution which will be abandoned once the typing system 
is understood.
The above "rape" cannot work because the size of the root type
is fixed and cannot be changed for a subtype,
neither enlarged nor reduced.

You are "deriving" in any way from another type.
That means that you create a different type being incompatible
the the original type.

Therefore, for the same purpose, you easily write

    type my_float_type is digits 14 ; 
    or
    type my_float_type is digits 14 range 0.0 .. 1.234e7 ; 

for example.

--
Peter Hermann  Tel:+49-711-685-3611 Fax:3758 ph@csv.ica.uni-stuttgart.de
Pfaffenwaldring 27, 70569 Stuttgart Uni Computeranwendungen
Team Ada: "C'mon people let the world begin" (Paul McCartney)



  reply	other threads:[~1994-09-29 11:37 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1994-09-28 15:16 Q: common types?! Tony Leavitt
1994-09-29 11:37 ` Peter Hermann [this message]
1994-09-29 15:35 ` Tucker Taft
1994-10-05  4:40 ` Daniel Wengelin
1994-10-12 17:39   ` gamache
1994-10-12 20:36     ` Kraig Hanson
1994-10-12 21:37     ` 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