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

Home » Public Forums » archive » Re: saving variables between calls to a procedure?
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: saving variables between calls to a procedure? [message #31610 is a reply to message #31609] Wed, 31 July 2002 14:43 Go to previous messageGo to previous message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Reimar Bauer wrote:
>
> Shawn wrote:
>
>> Hello,
>> I am just curious if there is a better way to save variables
>> between a call to a procedure than to define them in a common block
>> which is shared between procedures, or passing them back and forth.
>> One person suggested to me saving them to a file and re-reading a
>> file. But I am hoping for some simple way to declare a particular
>> variable as a "saved" variable, which IDL will remember the next time
>> the procedure is called. It actually just occured to me that I might
>> declare a common block which is actually not shared with any other
>> procedure, then I would be able to avoid mistakenly using the variable
>> in that procedure in a way that I did not intend to use it. Is it
>> possible to do this, declare a common block, but not use it in any
>> other procedure, and will IDL remember the variables if the common
>> block is not used in any other procedure? Of course it is simple for
>> me to test this on my own, so I guess I am really still asking if
>> there is a better way.
>> Thank you,
>> Shawn Young
>
> Dear Shawn,
>
> I don't like common blocks too. Most times I am using parameters
> as variable or structure or pointer.
> It depends on what's the routine should do.
>
> For example you can define a pointer as heap var or with a value
> outside in your main routine.
> If you know the reference ptr then you can access from
> all routines you want the data behind this pointer.
>
> pro define,ptr
> *ptr=[*ptr,10]
> end

Hmm. That seems like an extremely dangerous thing to do - couldn't you clobber something
by concatenating like that? If IDL is smart enough to recognise that the next bit of
memory may be used by something else it then seems that you would end up with a
non-contiguous data structure (in the figurative).

paulv

--
Paul van Delst
CIMSS @ NOAA/NCEP/EMC Beer is good.
Ph: (301)763-8000 x7274 My wife.
Fax:(301)763-8545
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: Image scrolling, displaying axes from outside the visible window
Next Topic: fft application?

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

Current Time: Fri Oct 10 07:19:43 PDT 2025

Total time taken to generate the page: 0.96248 seconds