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=-2.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI autolearn=unavailable autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,4947e94bd021c540 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-10-10 00:06:37 PST Path: archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.stueberl.de!teaser.fr!usenet-fr.net!enst.fr!melchior!cuivre.fr.eu.org!melchior.frmug.org!not-for-mail From: Duncan Sands Newsgroups: comp.lang.ada Subject: Re: C array to Ada pointer to unconstrained array without copyingmemory Date: Fri, 10 Oct 2003 09:02:23 +0200 Organization: Cuivre, Argent, Or Message-ID: References: NNTP-Posting-Host: lovelace.ada-france.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: melchior.cuivre.fr.eu.org 1065769243 57200 80.67.180.195 (10 Oct 2003 07:00:43 GMT) X-Complaints-To: usenet@melchior.cuivre.fr.eu.org NNTP-Posting-Date: Fri, 10 Oct 2003 07:00:43 +0000 (UTC) To: "Steve Adams" , comp.lang.ada@ada-france.org Return-Path: User-Agent: KMail/1.5.1 In-Reply-To: Content-Disposition: inline X-Virus-Scanned: by amavisd-new-20030616-p5 (Debian) at ada-france.org X-BeenThere: comp.lang.ada@ada-france.org X-Mailman-Version: 2.1.2 Precedence: list List-Id: Gateway to the comp.lang.ada Usenet newsgroup List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Xref: archiver1.google.com comp.lang.ada:580 Date: 2003-10-10T09:02:23+02:00 > Freeing a fat pointer with unchecked_deallocation is a good question, I > would guess that it does free correctly. However its any ones guess outside > of Gnat whether the data is freed in one call or as two. If two I am in > trouble :) > > However, every time i traced the use of these things the bounds were ALWAYS > immediately before the data in memory, suggesting a single allocation from > the heap. Yes, it seems like an obvious optimization: arrays allocated on the heap can have no address clause, so you can put the bounds with the data if you like, and reduce the number of memory allocations. Also, if the bounds are immediately before the data, doesn't that prove that it was done in one memory allocation, since (IIRC) malloc reserves some bytes for itself just before a block of memory it allocates, and GNAT uses malloc? Ciao, Duncan.