Use-define chain

A def -use chain is a data structure that describes the sequential pairs of read and write access to a variable.

In the context of software engineering are the white-box testing by Def -use chains data flow tests carried out which allow the passage of code using test values ​​for variables.

Example of use

The following is a def -use chain for the variable " d" should be created. The following code is the greatest common divisor ( GCD ) of two numbers, " a" and " b", and is implemented in Java.

Public int gcd ( int a, int b ) {      int c = a;      int d = b;      if ( c == 0)         return d;      while ( d! = 0) {         if ( c > d)            c = c - d;         else            d = d - c;      }      return c;   } To all def -use chains to produce for the variable " d", proceed as follows:

1.Ermitteln the first write access (definition of variable)

2.Ermitteln the first read access

3.Aufschreiben this information in the following style:

Now, these steps are repeated, each write access is associated with each write access of the examined variables.

The result is then:

225176
de