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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5117b1b6391a0e06 X-Google-Attributes: gid103376,public Path: g2news1.google.com!news1.google.com!news.glorb.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local1.nntp.dca.giganews.com!nntp.megapath.net!news.megapath.net.POSTED!not-for-mail NNTP-Posting-Date: Thu, 24 Jun 2004 15:59:40 -0500 From: "Randy Brukardt" Newsgroups: comp.lang.ada References: <1087410710.477506@master.nyc.kbcfp.com> Subject: Re: A simple ADA puzzle (I haven't the answer) Date: Thu, 24 Jun 2004 16:00:05 -0500 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4807.1700 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300 Message-ID: NNTP-Posting-Host: 64.32.209.38 X-Trace: sv3-mNA4DvTMbp7N1eG8m1hlyvw0R+WhiIgwdmf4XR2lTrT569K+UYDeNCGgCtugpX5gVUedD82etuBvIYP!foXOyUaIDSXDz10azX+NYGCljfzDqS+f7GkXGn2mOfokdDq+YXo2gWrwXnECbMK2tmfLT+KFBjAr X-Complaints-To: abuse@megapath.net X-DMCA-Complaints-To: abuse@megapath.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.1 Xref: g2news1.google.com comp.lang.ada:1865 Date: 2004-06-24T16:00:05-05:00 List-Id: "Frank J. Lhota" wrote in message news:riCCc.2700$A9.1045@nwrdny01.gnilink.net... ... > So if I understand the concept correctly, the way a compiler could handle > this type declaration would be to always allocate objects of this type off > of a heap, so that sizes could be adjusted as needed. In othr words, when > you declare > > My_String : STRING_TYPE; > > then My_String could actually hold a pointer to an object on the heap, with > the current LEN discriminant. If My_String were assigned a value with a > different value of LEN, the pointer in My_String would be changed if > necessary to point to a heap object of the appropriate size. Is this the > Janus Ada approach? Essentially, although the allocation only done for components that depend on discriminants and can change size (that is, arrays). Records are always allocated fixed size (only the array components can change size, and they're allocated separately). That works better when you have multiple array components. Randy.