Re: Naive pointer question ? [message #28999 is a reply to message #28944] |
Thu, 24 January 2002 09:52   |
Paul van Delst
Messages: 364 Registered: March 1997
|
Senior Member |
|
|
David Burridge wrote:
>
> Hi Paul et al.
>
>> <BIG snip>
>> p.s. Common blocks are not evil. They are unfairly maligned (and
> misaligned) but should be used
>> judiciously.... just like GOTOs.
>
> Sorry, I couldn't resist this!!! The problem with common blocks two-fold,
> both relating to their global scope (ie: the reason for using them in the
> first place). First, if you have two programs running in an IDL session
> (e.g. a pair of widget programs) which both use the same common block, each
> will corrupt the others data. In fact, you might even just be using two
> routines that don't realise another is accessing the common block.
This would most definitely be a non-judicious use of common blocks, i.e. badly designed code.
Forgoing common's in those cases usually isn't a solution. (Sure, the code *may* work)
> Secondly,
> you cannot trace the changes in a common block, so debugging becomes a
> nightmare. This is even worse in IDL when variables can change TYPE as well
> as value.
I'll trust you on this one.
paulv
--
Paul van Delst Religious and cultural
CIMSS @ NOAA/NCEP purity is a fundamentalist
Ph: (301)763-8000 x7274 fantasy
Fax:(301)763-8545 V.S.Naipaul
|
|
|