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

Home » Public Forums » archive » too many local variables
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
too many local variables [message #4708] Fri, 21 July 1995 00:00 Go to next message
brooker is currently offline  brooker
Messages: 12
Registered: March 1994
Junior Member
Help!!

I have a data analysis procedure that is up to 679 lines and when I try to add
some new code to it I get the error
"program unit has too many local variables"

I then delete the new code and rerun the program. Just before the end I placed a
STOP statement. After typing HELP I see that I have 236 local variables.

I take it then that the limit for local variables is slighly bigger than 236?

Has anybody else had this problem? How do you delete variables that you no
longer need in a procedure?

thanks-Peter Brooker
Re: too many local variables [message #4709 is a reply to message #4708] Fri, 21 July 1995 00:00 Go to previous messageGo to next message
Jing Xu is currently offline  Jing Xu
Messages: 2
Registered: July 1995
Junior Member
Hi
I think the easist way is save your program, quit IDL and start IDL
again.
Re: too many local variables [message #4769 is a reply to message #4708] Mon, 31 July 1995 00:00 Go to previous message
Joel Smith is currently offline  Joel Smith
Messages: 5
Registered: May 1995
Junior Member
You can delete variables by using the DELVAR command.

--
Joel Smith
Satellite Observing Systems
Godalming, Uk Tel: +44 (0)1483 421213 Fax: +44 (0)1483 428691
Re: too many local variables [message #4796 is a reply to message #4708] Mon, 24 July 1995 00:00 Go to previous message
knighton is currently offline  knighton
Messages: 12
Registered: June 1995
Junior Member
In <DC1IFL.K1v@ireq.hydro.qc.ca> brooker@toka.ireq-ccfm.hydro.qc.ca writes:

> Help!!

> I have a data analysis procedure that is up to 679 lines and when I try to add
> some new code to it I get the error
> "program unit has too many local variables"

> I then delete the new code and rerun the program. Just before the end I placed a
> STOP statement. After typing HELP I see that I have 236 local variables.

> I take it then that the limit for local variables is slighly bigger than 236?

> Has anybody else had this problem? How do you delete variables that you no
> longer need in a procedure?

There is a limit on local variable names. There are several ways to get around
this limit:

1. Use common blocks, these don't count against the local variable limit.
Be sure to keep less than 64 variables per common block however or you
will run up against another limit.
2. Partition your problem so that you use structures and arrays. A structure
or an array uses just one local variable name but can store numerous pieces
of information.
3. Break your program up into functions and procedures that are small and
accomplish simple, well-defined tasks. These modules should have only a
few variables and perhaps 25-100 lines of code each.

I have personally written applications that are thousands of lines long that
don't even come close to reaching the limit on local variables.

I think it would be helpful if all of these limits were documented somewhere.
RSI?

I hope this helps.

Ken Knighton, Systems Programmer
Work: General Atomics Home: knighton@cts.com
Magnetic Fusion Research Division
San Diego, CA
knighton@gav.gat.com
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: write_gif routine for PV~WAVE
Next Topic: Error - Program code area full

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

Current Time: Wed Oct 08 15:50:03 PDT 2025

Total time taken to generate the page: 0.00297 seconds