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,c1b1b81e16e83802 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-06-30 09:56:49 PST Date: Mon, 30 Jun 2003 18:56:05 +0200 From: =?ISO-8859-1?Q?Rodrigo_Garc=EDa?= User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.9) Gecko/20020513 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Help-memory allocation References: <87y8zjvckv.fsf@deneb.enyo.de> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: lglpc31.epfl.ch Message-ID: <3f006bcf$1@epflnews.epfl.ch> X-Trace: epflnews.epfl.ch 1056992207 128.178.76.8 (30 Jun 2003 18:56:47 +0200) Organization: EPFL Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!newsmi-us.news.garr.it!NewsITBone-GARR!news.mailgate.org!news-zh.switch.ch!switch.ch!epflnews.epfl.ch!not-for-mail Xref: archiver1.google.com comp.lang.ada:39937 Date: 2003-06-30T18:56:05+02:00 List-Id: Vinzent Hoefler wrote: > Florian Weimer wrote: > > >>Vinzent Hoefler writes: >> >> >>>>How to check whether the memory is allocated or not when using new >>>>operator?in other words, what the operator "new" returns if memory >>>>allocation fails? >>> >>>I'd say, it raises the Storage_Error exception. >> >>In conforming implementations, yes. However, many Ada implementations >>will only raise Storage_Error at some later point in the execution of >>the program ("commit on allocate" vs. "commit on use"). > > > Mmh, so in case someone relies on the occurence of the exception in > the very moment of the allocation, would it be wise to also give an > initial value to make sure we actually "use" the allocated memory? > > > Vinzent. I do not think this is necessary. Look at the dynamic semantics of allocators: even for uninitialized allocators, an object of the designated subtype is created and any implicit initial value is assigned. That is, allocation actually takes place when "new" is done. Florian, which Ada implementation are you using that is not conforming to the standard? Why do you say "many" Ada implementations are not conforming? Which ones? Rodrigo