Re: Naive pointer question ? [message #28972 is a reply to message #28944] |
Sat, 26 January 2002 13:16   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
btupper@bigelow.org (Ben Tupper) writes:
> On 24 Jan 2002 17:17:02 -0600, Craig Markwardt
> <craigmnet@cow.physics.wisc.edu> wrote:
>
>> I think there are at least two cases where common blocks are
>> pretty nice.
>>
>> The first one is where you need a persistent store of information.
>> For example, CMPS_FORM() keeps a list of printer configurations in a
>> common block. I also keep large tables in a common block, so they are
>> initialized only once to save CPU cycles. Any time you need a
>> procedure to "remember" something from one call to the next, common
>> blocks are actually a pretty good idea.
>>
> Howdy,
>
> While reading Craig's description of this particular 'memory'
> advantage of common blocks, I realized that the word 'object' could be
> slipped into the place of 'common block'. Hmmm.
>
> Objectively yours,
I appreciate that, however, common blocks appear to be the only way to
give a *function* persistent memory. If you use an object or a
pointer instead, you still have to pass this info into the function on
every call. There is indeed a time and a place for that technique,
but I think common blocks can be extremely useful and safe, if used
extremely carefully.
Commonly yours,
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|