> Hi,
>
> this intrigues me - what exactly is this problem all about?
>
> Cheers,
> Tobias
In CW 8, if you are building mach-O, global variables do not show up in the
variables pane at the upper right of the debugger window.
That pane has a switch that you can click from 'all' to 'auto'--in that case
globals will show up, but only on the specific line in which they are
referenced/changed. This may sound slightly useful but it isn't really.
The only way to see globals is to open the 'Global Variables' window, then
scroll to the top of it and click 'Global Variables' ,then scroll down the
(possibly hundreds) of global variables in the entire app to find the one
you want. And you have to do this every time you run the program.
It just makes debugging a slower process than usual, and it is frustrating.
Also, I don't know how you are supposed to find the value of static locals.
Bob
Tobias Giesen - 21 Aug 2003 00:23 GMT
Hi,
I see. What I usually do is enter the few ones I need into the Expressions
window. That works, doesn't it?
Ideally an OOP application would have only one global variable, the main
application object ...
Cheers,
Tobias
Alex Curylo - 24 Aug 2003 20:32 GMT
> The only way to see globals is to open the 'Global Variables' window, then
> scroll to the top of it and click 'Global Variables' ,then scroll down the
> (possibly hundreds) of global variables in the entire app to find the one
> you want. And you have to do this every time you run the program.
Well, I find an effective workaround is to just declare locals at the
beginning of the scope in question and assign them the global variables of
interest, assigning them back at the end if desired.
I think this also allows the optimizer to be a little more clever when
rearranging things like loops which depend on the now-local value. Although
somebody that actually knows jack about how the optimizer works might very
well find that a laughable misconception, I'm sure.

Signature
Alex Curylo -- alex@alexcurylo.com -- http://www.alexcurylo.com/
"Bar fight? I head for the safest place -- directly behind Al!"
-- Greg Chapman
Andy Dent - 25 Aug 2003 21:07 GMT
> Well, I find an effective workaround is to just declare locals at the
> beginning of the scope in question
Adding my two-cents worth of possibly-urban-myth about helping
optimisers, I particularly like copying to const locals. This also has
benefits in clarifying code and catching the odd stupid mistake.
(Sometimes I wonder if it's a good thing to confess in newsgroups my
obsession/need to code in a manner that catches stupid misteaks :-)

Signature
Andy Dent BSc MACS AACM
OOFILE - Database, Reports, Graphs, GUI for c++ on Mac, Unix & Windows
PP2MFC - PowerPlant->MFC portability
http://www.oofile.com.au/
Thomas Engelmeier - 26 Aug 2003 17:40 GMT
> Adding my two-cents worth of possibly-urban-myth about helping
> optimisers, I particularly like copying to const locals. This also has
> benefits in clarifying code and catching the odd stupid mistake.
>
> (Sometimes I wonder if it's a good thing to confess in newsgroups my
> obsession/need to code in a manner that catches stupid misteaks :-)
*grin* I guess everyone has some pecularities in this regard. I make
e.g. sure the source parameter for string copies etc. is const so the
compiler would catch any swapped( order parameter ); . Not that this
could happen in reality ;-)
Regards,
Tom_E