🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.lang.ada
Article #943

Re: Allocator Subtypes Question

#943
From: arny
Date: Fri, 05 Sep 1986 17:30
35 lines
1829 bytes
In article <12236430813.14.MENDAL@SU-SIERRA.ARPA> Mendal@SU-SIERRA.ARPA (Geoff Mendal) writes:
>
>We've read LMC-AI 00324/02, and paragraphs 4.8:3-6 of the Language
>Reference Manual, but still have a question concerning the behavior
>of the following program:
>
>  procedure Main is
>    type A is access Integer range -10 .. 15;
>    X : A;
>  begin
>    X := new Natural'(-5);
>    ...
>  end;
>
>Does evaluation of the allocator raise Constraint_Error or not?
>Why or why not.  We would appreciate appropriate LRM references
>to back up any "interpretations".  Thanks in advance.
>


Yes, evaluation of the allocator raises Constraint_Error because
the operand of the qualified expression used in the assignment
(-5) is not within the type mark given (Natural).

The qualified expression must be evaluated before its result can
be assigned to the object designated by X.  The appropriate
reference in the LRM is section 4.7, paragraph 3 (Qualified
Expressions).

BTW, I checked it on the (validated) AT&T UNIX Ada compiler, and
it checked out, but I don't know if the ACVC tests actually
tested that or not.  Anybody care to check?

   Thanks for a fun question, (hope the answer's correct!)
     Arny
Technical Details
Message-ID: <960@clyde.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!caip!clyde!arny@bonnie.ATT.COM
References: <12236430813.14.MENDAL@SU-SIERRA.ARPA>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!caip!clyde!arny@bonnie.ATT.COM
From: arny@bonnie.ATT.COM
Newsgroups: net.lang.ada
Subject: Re: Allocator Subtypes Question
Message-ID: <960@clyde.UUCP>
Date: Fri, 5-Sep-86 13:30:44 EDT
Article-I.D.: clyde.960
Posted: Fri Sep  5 13:30:44 1986
Date-Received: Fri, 5-Sep-86 22:01:18 EDT
References: <12236430813.14.MENDAL@SU-SIERRA.ARPA>
Sender: lp@clyde.UUCP
Reply-To: arny@bonnie.UUCP (Arny Engelson)
Organization: AT&T Bell Laboratories, Whippany NJ
Lines: 35
Keywords: Allocator, Subtypes