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

Home » Public Forums » archive » Delvar?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Delvar? [message #31363 is a reply to message #31225] Fri, 28 June 2002 14:07 Go to previous messageGo to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
David Fanning <david@dfanning.com> writes:

> David Fanning (david@dfanning.com) writes:
>
>> Alright. First of all, this code is inside a procedure.
>> That's important. UNDEFINE looks like this:
>>
>> ;*********************************************************** *********
>> PRO UNDEFINE, varname
>> IF (N_Elements(varname) NE 0) THEN tempvar = Size(Temporary(varname))
>> END
>> ;*********************************************************** *********
>
> Oh, oh. I think my problem is that I'm not anal enough. :-(
>
> It was gently pointed out to me that, uh, the SIZE function
> isn't really doing anything worthwhile here, so why put
> it in?

Hi David--

Actually I like the SIZE() function there. If VARNAME is a large
array, then you are just wasting cycles copying it to TEMPVAR, only to
have it erased a moment later when the UNDEFINE procedure returns.

What I do often enough is the following slight variation.

;*********************************************************** *********
PRO UNDEFINE, varname
varname = 0
tempvar = temporary(varname)
END
;*********************************************************** *********

This assures that the memory associated with VARNAME is released
first, and then the TEMPORARY() call is only there to release the "0".
In the line-count contest with you, I lose, but in the character count
contest, I win!

Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: gamma correction
Next Topic: Re: Defining constants in IDL?

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

Current Time: Fri Oct 10 16:09:17 PDT 2025

Total time taken to generate the page: 1.52028 seconds