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

Discussion in 'VHDL' started by Reuven, Mar 19, 2009.

  1. Reuven

    Reuven Guest

    On Mar 19, 8:59 am, Tricky <> wrote:
    > On 19 Mar, 15:58, Tricky <> wrote:
    >
    >
    >
    >
    >
    > > 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?

    >
    > Having just read that to myself, it must be pass by reference, else
    > the DEALLOCATE procedure itself wouldnt work!- Hide quoted text -
    >
    > - Show quoted text -


    Shouldn't the parameter be an "inout" and not just "in" ?
     
    Reuven, Mar 19, 2009
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jerry
    Replies:
    20
    Views:
    7,954
    Roedy Green
    Sep 9, 2005
  2. venkatagmail
    Replies:
    11
    Views:
    689
    James Kanze
    Oct 3, 2007
  3. Tricky
    Replies:
    0
    Views:
    580
    Tricky
    Mar 19, 2009
  4. Tricky
    Replies:
    0
    Views:
    1,008
    Tricky
    Mar 19, 2009
  5. Susan Cranford
    Replies:
    2
    Views:
    403
Loading...

Share This Page