[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Structure field concatenation



Martin Schultz (martin.schultz@dkrz.de) writes:

> Only if you want
> to replace the data in a structure element, then you need to free
> the pointer beforehand:
> 
>    ;; Replace data of first structure
>    IF Ptr_Valid(periodcube[0].freq) THEN Ptr_Free,
> periodcube[0].freq
>    periodcube[0].freq  = Ptr_New( DIndgen(200)*0.1 )

Actually, as I've been trying to point out for
months now to no avail, it is NOT necessary to
free the pointer in this instance. IDL *takes
care of the memory management for you*. :-)

    IF Ptr_Valid(periodcube[0].freq) THEN $
       *periodcube[0].freq  = newThingy

Cheers,

David

P.S. I'm sure Martin knows this. He is just being
thorough. A trait I have noticed among Germans. :-)

-- 
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155