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=0.7 required=5.0 tests=BAYES_00,INVALID_DATE, MSGID_SHORT,REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!husc6!panda!genrad!decvax!wanginst!vilot From: vilot@wanginst.UUCP (Michael Vilot) Newsgroups: comp.lang.ada Subject: Re: Elaboration of Parameterised Record Types Message-ID: <553@wanginst.UUCP> Date: Sun, 9-Nov-86 14:37:19 EST Article-I.D.: wanginst.553 Posted: Sun Nov 9 14:37:19 1986 Date-Received: Mon, 10-Nov-86 21:29:04 EST References: <386@cernvax.UUCP> Reply-To: vilot@wanginst.UUCP (Michael Vilot) Organization: Wang Institute, Tyngsboro, Ma. 01879 Keywords: subtype range attributes Summary: Another DEC Ada bug List-Id: In article <386@cernvax.UUCP> paul@cernvax.UUCP writes: > [ a reference from the Vax-Ada Programmer's Run-time Reference Manual] >However, this seems to conflict with the ARM (Ada Reference Manual) ... [ Section 7.6 ] > > max_possible_string : CONSTANT:=some_value; --Implem defined > SUBTYPE index IS INTEGER RANGE 0..max_possible_string; > TYPE text(this_string_maximum : index) IS > RECORD > > "From a user's point of view, a TEXT is a variable length string. Each > TEXT object has a maximum length, which must be given when the object is > declared, and a current value, which is a string of some length between > zero and the maximum." > ^^^^^^^ > >Which maximum??? Dec have assumed max_possible_string. But if this should >be so, why is it necessary to declare, and supply a value for, >"this_string_maximum"? > >On the contrary, it would appear that "this_string_maximum" is what the >(admittedly ambiguous) ARM intended to say. > >My question therefore is: >Is my understanding faulty or is my NUMERIC_ERROR the result of a coding >bug in the DEC Vax-Ada compiler, based on a DEC misinterpretation of the >ARM at this point? I would have thought that DEC should allocate storage >for the record according to the value of the parameter >"this_string_maximum" and not according to the type of >"this_string_maximum". > >In practice, many programs will work under either interpretation and will >give the same external behaviour. Internally however, the DEC >interpretation allocates much more space. Lastly, the DEC interpretation >cannot cope with examples such as the one below. The DEC implementation assigns 'LENGTH according to the BASE type, not the subtype. Hence the over-allocation of storage. The real workaround (on DEC Ada) is to use a named number, and not rely on the attribute. (Portable? Of COURSE it's portable! It works on any DEC implementation! :-) -- Michael J. Vilot ...!decvax!wanginst!vilot (UUCP) Wang Institute of Graduate Studies vilot%wanginst@CSNet-Relay (CSNet) Tyng Road, Tyngsboro, MA 01879 MVilot@ADA20 (ARPA)