comp.lang.ada
 help / color / mirror / Atom feed
Subject: Re: Help-memory allocation
Date: Mon, 30 Jun 2003 18:56:05 +0200
Date: 2003-06-30T18:56:05+02:00	[thread overview]
Message-ID: <3f006bcf$1@epflnews.epfl.ch> (raw)
In-Reply-To: bdpksc$vea6i$1@ID-175126.news.dfncis.de

Vinzent Hoefler wrote:
> Florian Weimer wrote:
> 
> 
>>Vinzent Hoefler <ada.rocks@jlfencey.com> 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




  reply	other threads:[~2003-06-30 16:56 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-30  9:11 Help-memory allocation prashna
2003-06-30  9:14 ` Vinzent Hoefler
2003-06-30 10:30   ` Rodrigo Garcia
2003-06-30 14:56   ` Florian Weimer
2003-06-30 15:25     ` Vinzent Hoefler
2003-06-30 16:56       `  [this message]
2003-07-01  9:15         ` Florian Weimer
2003-07-01  8:58       ` Florian Weimer
2003-07-03  6:53         ` prashna
2003-07-03  7:24       ` Robert I. Eachus
2003-07-01  9:06     ` prashna
2003-07-01  9:17       ` Florian Weimer
2003-07-01 12:21         ` 
2003-07-02 15:59 ` Richard Riehle
2003-07-02 22:35 ` Matthew Heaney
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox