When I declare my variables, should be it be like int delay = 0 then initialize to int delay = 0 or int delay then initialize to int delay = 0?
I'm a bit confused about initializing my variables...
void calc_pipe() {
/* Declare local vars */
int i;
int n;
int k;
int dep = 0;
int delay = 0;
int prev_delay = 0;
int total_delay = 0;
/* Check for dependencies */
/* For-loop: i = 2 to n */
for(i = 2; i <= n; i++) {
[B]/* Initialize local vars */[/B] <------ HERE
delay = 0;
/* For-loop: k = i - 2 to i - 1 */
for(k = i - 2; k <= i - 1; k++) {
[B]/* Initialize local vars */[/B] <------ HERE
if((set[k].dest == set[i].src1) || (set[k].dest == set[k].src2)) { /* RAW dependency */
dep = 1; /* ????? */
if(i - k == 2) {
if(prev_delay == 1) {
delay = 0;
prev_delay = 0;
}
else{
delay = 1;
prev_delay = 1;
}
}
else{
delay = 2;
prev_delay = 1;
}
}
else{ /* No RAW dependency */
if(dep == 0)
prev_delay = 0;
else
dep = 0;
}
} /* End of k-loop */
set[i].delay = delay + 1 + set[i - 1].delay;
total_delay += delay + 1;
} /* End of i-loop */