Ada: attribute 'last and 'safe_large
it's very common in Ada to create a derived type say a new Float type with the last element being Float'Last. I have not yet seen someone using Float'Safe_Large instead of the attribute Float'Last when defining a new Float type. On my 32-bit machine, bot开发者_开发百科h
Put( Float'Image( Float'Last ));
and
Put( Float'Image( Float'Safe_large ));
return me the value 3.402..E38
I would like to know the difference between these two number attributes and perhaps also why 'Safe_Large is not as commonly used as the attribute 'Last.
Thanks a lot...
Presently, the Last
attribute is defined for any scalar subtype. Now obsolete, Safe_Large
is available in GNAT as an implementation defined attribute for compatibility with Ada 83. The Ada 95 Rationale offers some insights about the change in the discussion on "Safe Range".
精彩评论