comp.lang.ada
 help / color / mirror / Atom feed
* Ada83: Attribute value for a float?
@ 1997-07-28  0:00 Andrew Lynch
  1997-07-28  0:00 ` Peter Hermann
  0 siblings, 1 reply; 2+ messages in thread
From: Andrew Lynch @ 1997-07-28  0:00 UTC (permalink / raw)



Hi,

we've just started "recycling" some old Ada83 code, which compiles
fine using GNAT, both with and without the -gnat83 switch.
When I took the code home and tried to compile it on my Linux box
with my universities Ada83 compiler it complained about the following:

    ...
    some_float := FLOAT'value(some_string);
    ...


Looking in the LRMs I found the following:

Ada83 LRM Annex A:
P'VALUE   For a prefix P that denotes a discrete type or subtype...

Ada95 LRM Annex K:
S'Value   For every scalar subtype S...

IIRC a float is scalar, but not discrete which I would take to mean
that Float'Value is not legal Ada83.

The code was aparently developed using the Telesoft Ada compiler around
1992/1993 and also compiled on a number of other Ada83 compilers
(so say the guys who've been here longer than I have...)
So is this valid Ada83, or maybe an extension that was supported by
many compiler vendors (and then made it into Ada95)?

A definite answer/reference would be appreciated!

Andrew.




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

* Re: Ada83: Attribute value for a float?
  1997-07-28  0:00 Ada83: Attribute value for a float? Andrew Lynch
@ 1997-07-28  0:00 ` Peter Hermann
  0 siblings, 0 replies; 2+ messages in thread
From: Peter Hermann @ 1997-07-28  0:00 UTC (permalink / raw)



Andrew Lynch (lynch@cci.de) wrote:
>     some_float := FLOAT'value(some_string);

should not compile under -gnat83 !
or even better, IMHO: could be compiled ;-) with a big warning
for the sake of better working support.

> Ada83 LRM Annex A:
> P'VALUE   For a prefix P that denotes a discrete type or subtype...

> Ada95 LRM Annex K:
> S'Value   For every scalar subtype S...

> IIRC a float is scalar, but not discrete which I would take to mean
> that Float'Value is not legal Ada83.

you took correctly: this is not legal Ada83.

> A definite answer/reference would be appreciated!

The attributes 'value and 'image are complementary,
(similarly like  'val and 'pos)
both do not work for floating point of fixed point scalars in Ada83.

--
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)




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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-07-28  0:00 Ada83: Attribute value for a float? Andrew Lynch
1997-07-28  0:00 ` Peter Hermann

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