Click to See Complete Forum and Search --> : Integer variable Tracker tool or Algorithm


agutal
March 11th, 2009, 06:47 AM
help needed.

I want a tool which will track a variables or pieace of code which is affected by a particular variable.

Means it will check for dependencies on a particular variable.


eg.

int i;

int x = i +10 ;

int k = x - 1;

in above example integers 'x' and 'k' are dependent on [int 'i' .
so i want such a tool or algorithm which may track dependecies on a particular Variable.


Please help. Thanks in advance.

ProgramThis
March 11th, 2009, 09:33 AM
Well, depending on which language you are using, this is near impossible. Primitive data types do not share a state with other primitive types, whereas objects are references to the memory location where the data is stored.

Read this article (http://www.cs.unc.edu/~dewan/comp114/s09/Class%20Notes/8_Pointers_Notes.pdf) which explains how Java allocates memory for primitives and objects.

laserlight
March 11th, 2009, 09:49 AM
My university has a software engineering module where the task has invariably been to develop such a static analysis tool for a toy language. I imagine that it is possible to develop such a static analysis tool for a real world programming language, especially since it is a variant of the static analysis tools available today that check for bugs and potential problems in code written in programming languages like C and C++.

That said, if such a tool does not already exist, I suppose you will just have to make do with a debugger, like how one would make do with the high warning levels of a compiler.