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

Home » Public Forums » archive » global variables and IDLSPEC issues
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: Global variables and IDL [message #14982 is a reply to message #11537] Wed, 14 April 1999 00:00 Go to previous messageGo to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
rmlongfield writes:

> HI All, I've been thinking about this question myself lately.
> As far as I understand, the use of COMMON blocks is not
> recommended when working with widgets, but is ok otherwise.
> I have heard that there may be a problem if there are too
> many variables, but 20 seems ok to me.

Well, I'd say that common blocks should only be used when there
is *no* conceivable way you'd *ever* want to have more than one
version (instance) of your data. You *may* want to generate a
slightly altered data set and view that along side the original
data set at some point in time.

As such, only a few situations *really* qualify -- like the
common blocks used (internally) by XMANAGER. There's no way
you'd ever want to have *two* lists of managed widgets.

Another extremely good example is the list of singleton objects
used by J.D. Smith's singleton abstract class.

A singleton (sub)class is defined by the fact that only one
instance (object) of that class should exist at any one
time. The singleton INIT method needs to know whether or not an
object of the same class already exists. In order to do this,
one needs to have a list of existing singleton objects. There
is no way you'd ever want to have *two* such lists (defeats the
purpose...), so you can safely put it into a common block.

In general, common blocks are good for storing information used
in a (globally available) system that keeps track of things...
The "things" themselves should not be put into common blocks
:-)

Having said this, I must confess that yes, I have used common
blocks for other purposes, but that's only for very small, very
experimental programs.

> I have an image processing tool which uses a base data set
> but many different widget modules, each with its own TOP
> LEVEL WIDGET. I would like to have access to this data from
> whatever or whichever widget I am working in. The data sets
> I read are created in the middle of my processing, so it
> would do no good to read it at the start and have a general
> pointer that can be included in each Top Level Widget.

You should take advantage of the fact that you can create a
pointer without pointing it at anything:

storage = ptr_new()
xstartprog,storage=storage ;; Data will be available later...
xutility,storage=storage ;; Ditto.
xreaddata,storage=storage ;; This one will read the data...

Regards,

Stein Vidar
[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
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Reading DXF?
Next Topic: Help for Wav

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

Current Time: Mon Dec 01 00:35:22 PST 2025

Total time taken to generate the page: 0.00246 seconds