From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e8c8d1c63ffacf0d X-Google-Attributes: gid103376,public From: Tucker Taft Subject: Re: Constraint checking of actuals passed to Attributes Date: 2000/05/08 Message-ID: <39171B69.2F983487@averstar.com>#1/1 X-Deja-AN: 620789919 Content-Transfer-Encoding: 7bit References: <391250A8.99D1585C@hotmail.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: usenet@inmet2.burl.averstar.com X-Trace: inmet2.burl.averstar.com 957815658 1059 141.199.8.164 (8 May 2000 19:54:18 GMT) Organization: AverStar (formerly Intermetrics) Burlington, MA USA Mime-Version: 1.0 NNTP-Posting-Date: 8 May 2000 19:54:18 GMT Newsgroups: comp.lang.ada Date: 2000-05-08T19:54:18+00:00 List-Id: Matt Brennan wrote: > > Quick question: > > Is an implementation required to generate code to check that an actual > parameter passed to an attribute (for example, 'Image of a scalar type) > is subtype conformant with the formal parameter? Most attribute functions like 'Image, 'Pos, etc., have the base subtype as the parameter subtype, meaning that no constraints apply. Hence, the only possible problem occurs if the actual parameter is not a value of the *type* which could happen due to unchecked conversion, (unchecked) binary input, or an uninitialized variable. Implementations are not required to deal nicely with the unchecked conversion or binary input situation, but are required to at least "survive" the uninitialized variable situation in Ada 95. This is because the first two are "erroneous" situations whereas the last one is merely a "bounded error." This means that in the first two cases, anything could happen (incineration of disk drive, etc.), whereas in the uninitialized case, Program_Error, Constraint_Error, or producing some arbitrary value as the result would be acceptable. In Ada 83, using uninitialized variables is erroneous as well, so some compilers out there might still misbehave on them due to bugs or ancestry. > Opinions with ARM references most welcome! :-) RM95 A.13(17) -- unchecked binary input RM95 13.9(11)/13.9.1(8) -- unchecked conversion/abnormality RM95 13.9.1(9-11) -- uninitialized variable bounded error > > Matt -- -Tucker Taft stt@averstar.com http://www.averstar.com/~stt/ Technical Director, Commercial Division, AverStar (formerly Intermetrics) (http://www.averstar.com/services/IT_consulting.html) Burlington, MA USA