On Fri, 15 Aug 2008, Frank Wallingford wrote:
>> When you get this msg from a compile, you still have to find out which
>> uses of the variable are the offending entries. If I have 45 uses of x,
>> how do I find out which ones are causing the msg?
>>
>> The compiler knows, but it keeps that information to itself.
>
> If you have 45 uses of 'x' in a routine and each one does its own
> initialization (i.e. you don't initialize 'x' at the top of the routine) I
> would argue that your code could use some refactoring.
>
> -Frank
>
> --
> ----------------------------------
> Frank Wallingford
> [EMAIL PROTECTED]
>
>
That is precisely why I don't initialize the variable with the
declaration. Ifg I did, the msg would go away, but the error will still
be there, and would have to be found out through painful debugging, like
with gdb. I never use gdb. it is a complete waste of time to go stepping
through a program, especially if the test case runs for 10 minutes before
failing. All gdb does with a breakpoint is tell you that there you are.
It doesn't tell you how it got there, or which variables should have been
computed somewhere along the way but aren't.
The analysis and debugging tools must be usable for running in a
production environment where it might run for an hour before encountering
a proble. Stepping and breakpoints are worthless in such an environment.
Also I don't particularly care about the program structure, because it is
all generated code, which has generated gotos in it, which I also don't
care about. I don't ever look at the generated code unless I have to.
Ideally an analysis tool would tell me the exact possible paths through
the code from the variable declaration to the offending point of use,
as well, but I don't expect to see any general tools for finding that any
time soon.
To make matters worse, the program generator also generates variable
names, both for declarations and for uses, so in the actual source code
the variable name Qr may never be present, but might be generated by a
construct such as {PQ}r, which produces Qr if the string {PQ} generates a
Q.
I already have a thing in place that tells me which actual source line
generates each actual source code line, so if I can find a line in the
generated code where Qr is used without being set, I know which source
line to look at.
In the past, I have always found these problems either by commenting out
the possible using stmts one at a time, or in groups, which doesn't always
work very well when there is more than a couple of offending stmts,
or by putting in a set of the variable in front of each possible use
until the msg goes away.
Lex
_______________________________________________
Mid-Hudson Valley Linux Users Group http://mhvlug.org
http://mhvlug.org/cgi-bin/mailman/listinfo/mhvlug
Upcoming Meetings (6pm - 8pm) MHVLS Auditorium
Jun 4 - Sqeak! and eToys
Jul 2 - KVM (Tenative)
Aug 6 - Zenos
Sep 3 - TBD