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!news2.google.com!news.maxwell.syr.edu!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 16:04:30 -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:04:55 -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-QUBhckY75p6PezGroL0pQYXWUM8cFUCmfZl335UehfLRkEUUwDh7/RALgcXDS8EKCsKZp/P4zCEAHPF!fdNroEDcD9qe011fpOHO/M34HNRykd2jj3NrVc8XPyzc8pnIx0Cdyf2yNnpzEK9VucqUcpmDnyuS 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:1866 Date: 2004-06-24T16:04:55-05:00 List-Id: "Ed Falis" wrote in message news:opr93v80kw5afhvo@localhost... > On Thu, 24 Jun 2004 15:19:51 GMT, Frank J. Lhota > wrote: > > > 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? > > This is the same approach the Alsys compilers used, Frank. Except that > the object could be allocated on stack as well on 68K targets (if memory > serves). The downside is all the potential allocation, deallocation and > copying should the discriminant change. I thought I remembered that at least one other Ada 83 compiler did this. Since we used the Alsys compiler as our model when in doubt, it's not surprising that we decided to support that as well. I understand that there is a lot of overhead when the size changes in this approach. But there is nothing preventing implementors from using the Max_Size approach when the Max_Size is reasonably small. That would leave the costs only to objects for which there is little choice. I really see no downside to requiring this support - customers want it and try to use it all the time; it wouldn't have a performance impact on types that already work; and the restriction No_Implicit_Heap_Allocation would be used if you really had to avoid the overhead. But I'm in the minority on this one. Randy.