Variable Input on procedure - pass by value or pass by reference?

T

Tricky

I have the following in my code:

type img_2d_ptr is access image_grey_2D_t;
type image_array_t is array(natural range <>) of img_2d_ptr;
shared variable PIP_IMAGES : image_array_t(PIP_REGISTERS'range) :=
read_PIP_images;

procedure destroy_images( variable x : in image_array_t ) is
begin
for i in x'range loop
DEALLOCATE( x(i) );
end loop;
end procedure destroy_images;

The pass by reference/value is quite important here, because I need to
actually make sure the images are actually deallocated, and it doesnt
deallocate just a copy of them.

Would it just be safer to ignore the input on the procedure and just
deallocate the PIP_IMAGES shared variable directly?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,264
Messages
2,571,065
Members
48,770
Latest member
ElysaD

Latest Threads

Top