Program slicing: Difference between revisions

Content deleted Content added
m product var always will be 0
Line 39:
Makes use of information about a particular execution of a program. A dynamic slice contains all statements that actually affect the value of a variable at a program point for a particular execution of the program rather than all statements that may have affected the value of a variable at a program point for any arbitrary execution of the program.
 
An example to clarify the difference between static and dynamic slicing. Consider a small piece of a program unit, in which there is an iteration block containing an if-else block. There are a few statements in both the <code>if</code> and <code>else</code> blocks that have an effect on a variable. In the case of static slicing, since the whole program unit is looked at irrespective of a particular execution of the program, the affected statements in both blocks would be included in the slice. But, in the case of dynamic slicing we consider a particular execution of the program, wherein the <code>if</code> block gets executed and the affected statements in the <code>else</code> block do not get executed. So, that is why in this particular execution case, the dynamic slice would contain only the statements in the <code>if</code> block.
 
==See also==