[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Global variables and IDL
Martin Schultz wrote:
> David Fanning wrote:
> > Walter Roberson (email@example.com) writes:
> > > Jim Russell wrote:
> > >
> > > :I'm certain that IDL has a global variable (I remember it being mentioned in
> > > :Fanning's book), but don't remember how to invoke it. Maybe someone else can
> > > :provide that for you.
> > >
> > > Use a common block. That requires adding only one extra statement to each
> > > routine that uses an element of the common, and requires no other code
> > > changes.
> > I'm quite sure you didn't find a common block recommendation in
> > Fanning's book. :-(
> Here is my confession: yes, I use common blocks (and goto statements),
> and I don't even
> feel too bad about it -- although it happens probably mostly for lack of
> knowledge of
> better ways (perhaps Davids' third book will be able to change this?).
I applaud your courage Martin! My name is David Foster, and I have
been a common-block user...
I think the idea of global variables would be very powerful, and the
ability to have global pointers would be extremely useful in our
applications. We have a series of programs that are run consecutively,
on the same LARGE data-sets, and we use common blocks to store these
data sets. We find this approach much faster than other possibly
"cleaner" programming approaches, and for our purposes we would never
want to have more than one instance of one of these programs running.
If we did, we could certainly structure the common variables to
If global variables were to be introduced into IDL, I would hope
that we would also get some mechanism for limiting the visibility
of these variables, some way to say "use this global variable" within
a routine. Something similar to the EXTERN construct in C.
Coming from a C background, my first impression of IDL was that it
provides *very* limited control over scope and visibility of variables
and function/procedure names.
David S. Foster Univ. of California, San Diego
Programmer/Analyst Brain Image Analysis Laboratory
firstname.lastname@example.org Department of Psychiatry
(619) 622-5892 8950 Via La Jolla Drive, Suite 2240
La Jolla, CA 92037