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

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top