If the variable is an instance of a class with a constructor and/or
destructor, those functions will get called thousands of times. Otherwise,
not a whole lot. From a runtime point of view, it would be the same as if
"winH" were defined outside the loop.
One might argue that putting "winH" inside the loop give the compiler a
better opportunity to optimize the functions register usage. However, I
consider that assertion an implementation detail -- and one that isn't
always borne out in practice.
-- Keith
Richard Burmeister <[EMAIL PROTECTED]> wrote in message
news:30448@palm-dev-forum...
>
> From: "Steve Mann" <[EMAIL PROTECTED]>
> > do {
> > WinHandle winH = WinGetActiveWindow ();
> > // snip ...
> > }
> > while (event.eType != appStopEvent);
>
> I don't have the answer to Steve's question, but this code has prompted a
> new question from me. What exactly is the effect of declaring and
> initializing winH inside this loop which will be executed thousands of
> times?
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/