Re: ALLOCATE questions




"Roger While" <simrw@xxxxxxxxxxxx> wrote in message
news:e7r18m$4bf$01$1@xxxxxxxxxxxxxxxxxxxx
Standard says -
"2) If arithmetic-expression-1 evaluates to 0 or a negative value, the
data
item referenced by data-name-2 is set to
the predefined address NULL."

No exception condition set ?

Apparently not. Why should NULL be an exception?
If the programmer wishes to treat NULL as an exception,
why not
if address of data-name-2 equal null
*> handle progammer-defined exception
end-if
?


What is supposed to happen if a second ALLOCATE is done
for the same item (Without an intervening FREE) ?
(Implicit FREE/ReALLOCATE ?)

14.8.3.3 [ALLOCATE statement] General rules,
"10) The allocated storage persists until explicitly released
with a FREE statement or the run unit is terminated,
whichever occurs first."

It is possible that the address of a based item could be
assigned to a data-pointer before the next allocation to
the same based item; in fact, I would think it likely if one
is using linked lists, trees, or the like.

This is not to say that an implementor could not maintain
reference counts for memory allocations and automatically
free them when there are no outstanding references
(garbage collection).



.



Relevant Pages

  • Re: Technical two dimensional array question
    ... > Does it allocate a contiguous blocks of memory or not? ... What it allocates is memory space for *references* to string objects, ... > I tried it and I get an exception error, as I should, but, ... allocated array. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Non-failure guarantied malloc/new
    ... >> error code to the caller to inform that something went wrong. ... After all I can recieve such a exception at any time so I will have no ... > You could allocate all needed memory in static blocks. ...
    (comp.lang.cpp)
  • Re: .Net Exceptions
    ... >> Why should user data die if a coponent which has nothing to do with you ... >> data throws an Exception? ... Since the request to allocate ... And if Iam wrong then the App crashes when there is really a problem which ...
    (microsoft.public.dotnet.general)
  • RE: StackOverflowException
    ... I think I've discovered what's causing it, although I don't really know what ... It seems that the call to new I'm using to allocate the array is what is ... locktable is null when I'm attempting to allocate my unmanaged array. ... > which throws the exception. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: throwing out of memory exception in c++ doesnt work
    ... > If you've got a reasonably healthy quantity of virtual memory available, ... > bit and add some exception handling: ... > allocate before the thrashing commences and try to keep track of what ... thrown, when allocating the array of ints, but I am trying to allocate a ...
    (comp.lang.cpp)