Re: ALLOCATE questions
- From: "Rick Smith" <ricksmith@xxxxxxx>
- Date: Tue, 27 Jun 2006 09:30:48 -0400
"Roger While" <simrw@xxxxxxxxxxxx> wrote in message
news:e7r18m$4bf$01$1@xxxxxxxxxxxxxxxxxxxx
Standard says -data
"2) If arithmetic-expression-1 evaluates to 0 or a negative value, the
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).
.
- References:
- ALLOCATE questions
- From: Roger While
- ALLOCATE questions
- Prev by Date: Re: Logic for missing END-xxx statement syntax
- Next by Date: Re: Logic for missing END-xxx statement syntax
- Previous by thread: Re: ALLOCATE questions
- Next by thread: OT (mostly)
- Index(es):
Relevant Pages
|
|