[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: static vars
From: |
Rick Riolo |
Subject: |
Re: static vars |
Date: |
Mon, 28 Sep 1998 07:06:30 -0400 (EDT) |
I can't really tell for sure what you did from your description,
but the symptoms ("moved one thing from here to there, then
it only worked after a make clean") sounds like a case
where addressing gets messed up.
You say you:
> I moved the static vars to the "h" file as part of the object def (just a
> different way of making a static.)
Do you really mean you put it in the class definition?
If so, perhaps some other class has knowledge/use of that class,
and you don't have the dependencies correct in your Makefile.
So on the first make, you re-made your object, changing
the underlying structure size, instance variable locations, etc.
But that other object didn't get re-made, and when it accesses
the object it gets screwed up.
And so the re-make fixed it.
Note other files don't need to know about that variable you moved,
just know about and use that class.
As I said, its just a guess from the symptoms you list.
Regarding your first report, of it not working as expected
when declared static in the method, I couldn't tell exactly
what the problem was from what you showed.
Did you mean that after you did the loop assigning from new
to old that if you did a printf of old right then
that it did not have the new values?
- r
Rick Riolo address@hidden
Program for Study of Complex Systems (PSCS)
4477 Randall Lab
University of Michigan Ann Arbor MI 48109-1120
Phone: 734 763 3323 Fax: 734 763 9267
http://www.pscs.umich.edu/PEOPLE/rlr-home.html
On Sun, 27 Sep 1998, donalson wrote:
> Date: Sun, 27 Sep 1998 15:59:31 -0700
> From: donalson <address@hidden>
> To: address@hidden
> Subject: Re: static vars
>
> Marcus,
>
> Since you and I agree on that, I have to believe that there is something
> weird in Cygnus.
> I moved the static vars to the "h" file as part of the object def (just a
> different way of making a static.)
> (Note I no longer declaired than static.) The result was that my program
> quit running, ie all the initialization worked, but the schedule never
> started. I finally discovered that I could get it to work only if I did a
> "make clean" before remaking it. This is particullarly odd because those
> variables are never referenced outside the object itself, and there are no
> other variables even close to that name anywhere else in the program.
>
> Oh well...
>
> Cheers,
>
> D3
>
> Marcus G. Daniels wrote:
>
> > >>>>> "D3" == donalson <address@hidden> writes:
> >
> > D3> I thought that static meant that when the method was used, "old"
> > D3> would contain the previous values of "new".
> >
> > The elements in `old' should each retain their last assigned value.
> >
> > ==================================
> > Swarm-Support is for discussion of the technical details of the day
> > to day usage of Swarm. For list administration needs (esp.
> > [un]subscribing), please send a message to <address@hidden>
> > with "help" in the body of the message.
> > ==================================
>
> --
> *********************************************************************
> * Doug Donalson Office: (805) 893-2962
> * Ecology, Evolution, Home: (805) 961-4447
> * and Marine Biology email address@hidden
> * UC Santa Barbara
> * Santa Barbara Ca. 93106
> *********************************************************************
> *
> * The most exciting phrase to hear in science, the one that
> * heralds new discoveries, is not "EUREKA" (I have found it) but
> * "That's funny ...?"
> *
> * Isaac Asimov
> *
> *********************************************************************
>
>
>
> ==================================
> Swarm-Support is for discussion of the technical details of the day
> to day usage of Swarm. For list administration needs (esp.
> [un]subscribing), please send a message to <address@hidden>
> with "help" in the body of the message.
> ==================================
>
==================================
Swarm-Support is for discussion of the technical details of the day
to day usage of Swarm. For list administration needs (esp.
[un]subscribing), please send a message to <address@hidden>
with "help" in the body of the message.
==================================