[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Global variable vs common block

Marc (m_schellens@hotmail.com) writes:

> I have a very large program which uses common blocks (sorry David),
> nowadays I don't like them any more (never liked them but lately I
> discovered the DEFSYSV command :-). I used for the whole program just
> one common block holding one structure (all the global data).
> It was easy to change the suff to use a ('!named') global variable, and
> at a first look everything seem to work fine.
> So my question is: Is there something I have not thought about/do not
> know were I can run into a limitation with this?
> Wanna know this before I spent more time on the prog and eventually have
> to change it back.

I don't know how I gained this reputation as a common
block ogre. My mission was never to ban common blocks,
only to make people think seriously about the alternatives
before they blindly used one. Since "common block" can
hardly be mentioned on this newsgroup without the word
"David" nearby, I must have been successful :-)

In any case, I can't see any problem with DEFSYSV,
except the usual one of changing the definition of
the variable on the fly. And with the new .RESET_SESSION
even that point is nearly moot.


David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155