comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Undefining a variable a pointer points to
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Undefining a variable a pointer points to [message #39333] Fri, 14 May 2004 14:07 Go to next message
Benjamin Hornberger is currently offline  Benjamin Hornberger
Messages: 258
Registered: March 2004
Senior Member
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
Re: undefining a variable [message #50110 is a reply to message #39333] Wed, 13 September 2006 09:21 Go to previous message
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
Elegance certainly has its place. When you are dusting off a routine
you may have written eight years ago, and you say, 'Now why the devil
did I just set that entire huge structure = 0?', you'd better hope you
commented your code (boo!), or else used a nice intuitive command like
UNDEFINE() (yay!).



David Fanning wrote:
> Gianguido Cianci writes:
>
>> undefine.pro is clever, but sometimes it is sufficient to set that var
>> to a scalar value. That frees up the memory, though it won't free up
>> the name :-) I haven't needed undefine so far so I thought I'd post my
>> 2 cents.
>
> UNDEFINE wasn't written because it was "needed". It
> was written because it was "elegant". :-)
>
> Cheers,
>
> David
> --
> David Fanning, Ph.D.
> Fanning Software Consulting, Inc.
> Coyote's Guide to IDL Programming: http://www.dfanning.com/
> Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: undefining a variable [message #50115 is a reply to message #39333] Tue, 12 September 2006 18:25 Go to previous message
cgguido is currently offline  cgguido
Messages: 195
Registered: August 2005
Senior Member
David Fanning wrote:

> UNDEFINE wasn't written because it was "needed". It
> was written because it was "elegant". :-)
>

Sorry, I mean't clever AND elegant. Of course. But the stuff you guys
come up with is always more elegant (and clever) than by dumb for-loop
approaches ;-) I am getting too used to it and forgot to mention it....

Gianguido
Re: undefining a variable [message #50121 is a reply to message #39333] Tue, 12 September 2006 08:35 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Gianguido Cianci writes:

> undefine.pro is clever, but sometimes it is sufficient to set that var
> to a scalar value. That frees up the memory, though it won't free up
> the name :-) I haven't needed undefine so far so I thought I'd post my
> 2 cents.

UNDEFINE wasn't written because it was "needed". It
was written because it was "elegant". :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: undefining a variable [message #50122 is a reply to message #39333] Tue, 12 September 2006 08:27 Go to previous message
cgguido is currently offline  cgguido
Messages: 195
Registered: August 2005
Senior Member
undefine.pro is clever, but sometimes it is sufficient to set that var
to a scalar value. That frees up the memory, though it won't free up
the name :-) I haven't needed undefine so far so I thought I'd post my
2 cents.

Gianguido
Re: undefining a variable [message #50126 is a reply to message #39333] Tue, 12 September 2006 07:20 Go to previous message
Ingo von Borstel is currently offline  Ingo von Borstel
Messages: 54
Registered: September 2006
Member
Hi,
>
>> is there a way to undefine a variable in IDL?
>> I cannot seem to find anything in the docs.
>
> http://www.dfanning.com/programs/undefine.pro

Thanks a lot! That was really quick and helpful

Ingo

--
Ingo von Borstel <newsgroups@planetmaker.de>
Public Key: http://www.planetmaker.de/ingo.asc

If you need an urgent reply, replace newsgroups by vgap.
Re: undefining a variable [message #50127 is a reply to message #39333] Tue, 12 September 2006 07:08 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Ingo von Borstel writes:

> is there a way to undefine a variable in IDL?
> I cannot seem to find anything in the docs.

http://www.dfanning.com/programs/undefine.pro

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: postscript character
Next Topic: Java Bridge Question

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Thu Oct 09 21:43:44 PDT 2025

Total time taken to generate the page: 0.95968 seconds