Re: Undefining a variable a pointer points to [message #39321] |
Sun, 16 May 2004 23:10 |
marc schellens[1]
Messages: 183 Registered: January 2000
|
Senior Member |
|
|
Benjamin Hornberger wrote:
> Hi all,
>
> is there a way to undefine the variable a pointer points to? E.g., if I
> initialize a pointer by
>
> p = ptr_new(/allocate_heap)
>
> p is a valid pointer, but *p is undefined. If I now do
>
> *p = 10
>
> is there a way to undefine it again afterwards, i.e. get back to the
> status right after the call to ptr_new(/allocate_heap)?
>
> Thanks for your help,
> Benjamin
dummy=temporary(*p) would also work.
HDH,
marc
|
|
|
Re: Undefining a variable a pointer points to [message #39332 is a reply to message #39321] |
Fri, 14 May 2004 14:30  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Benjamin Hornberger writes:
> is there a way to undefine the variable a pointer points to? E.g., if I
> initialize a pointer by
>
> p = ptr_new(/allocate_heap)
>
> p is a valid pointer, but *p is undefined. If I now do
>
> *p = 10
>
> is there a way to undefine it again afterwards, i.e. get back to the
> status right after the call to ptr_new(/allocate_heap)?
Well, not sure *why* you want to be doing this, but if
it's necessary, you can do this:
Ptr_Free, p
p = Ptr_New(/Allocate_Heap)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|