C compilers/variables

Gerald Hawkins jerry at starfish.Convergent.COM
Fri Apr 28 04:24:33 AEST 1989


Is anyone aware of a program to analyze a c-program for the variables it
uses, producing a table showing the usage?  I had a Fortran compiler
which did this once, but I've not seen it for c.

An example of the output I would want:
Variable_Name       Used on Line(s)
a                   37, 43, 53 (main)
b                   21 (global)
					45, 57, 63 (main)
					135, 145, 159 (crashsystem)
					175, 185, 195 (fixsystem)

Function_Name
getch()             47, 49, 51 (main)
					136, 139, 143 (crashsystem)

I think you get the idea.  The purpose of this is to help track down
variables--especially global ones--which you might overlook while
maintaining code.  Also when writing code, to help remind one to #include
the necessary headers for the functions used.



"	I don't want to imply I'm underpaid, but ...
	Last time I took my paycheck to the bank to be cashed, the teller
	asked me, 'How would you like that, sir, Heads, or Tails?'	"

Jerry		( jerry at starfish.Convergent.COM )
-----



More information about the Comp.lang.c mailing list