开发者

Ada: attribute 'last and 'safe_large

开发者 https://www.devze.com 2023-01-08 12:49 出处:网络
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

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".

0

精彩评论

暂无评论...
验证码 换一张
取 消