A
Amal
Guest
I am writing a to_string function for a type that I have defined. I
have used the STD.TEXTIO' write function to write a string
representation of the type that is of variable length to a line (L).
The function looks something like below:
impure function to_string( ... ) return string is
variable L : line;
begin
write( L, string'("+--------+") & CR );
for i in .... loop
write( L, ... );
end loop;
write( L, ... );
return L.all;
end function to_string;
L is an access type and write function keeps deallocating L and
allocating more storage (the string that L points to would grow in
size from write to write). My question is that, normally it is best
to release the storage pointed to by L by calling deallocate on L.
But in this case I cannot call deallocate(L) explicitly before the
function returns. Do simulators release the storage after the
function returns?
-- Amal
have used the STD.TEXTIO' write function to write a string
representation of the type that is of variable length to a line (L).
The function looks something like below:
impure function to_string( ... ) return string is
variable L : line;
begin
write( L, string'("+--------+") & CR );
for i in .... loop
write( L, ... );
end loop;
write( L, ... );
return L.all;
end function to_string;
L is an access type and write function keeps deallocating L and
allocating more storage (the string that L points to would grow in
size from write to write). My question is that, normally it is best
to release the storage pointed to by L by calling deallocate on L.
But in this case I cannot call deallocate(L) explicitly before the
function returns. Do simulators release the storage after the
function returns?
-- Amal