General Guidelines
void init() {
}
void func() {
printf("val %d",val);
}
int main() {
init();
func();
}
Good: IPA knows
Avoiding Aliases
It may seem that the iterations may be performed in any order in the fol-
lowing loop:
void fn(char a[], char b[], int n) {
int i;
for (i = 0; i < n; ++i)
a[i] = b[i];
}
Bad:
and
a
b
but
and
are both parameters, and, although they are declared with
a
b
they are in fact pointers, which may point to the same array. When the
same data may be reachable through two pointers, they are said to alias
each other.
If IPA is enabled, the compiler will look at the call sites of
determine whether
Even with IPA, it is quite easy to create what appear to the compiler as
aliases. The analysis works by associating pointers with sets of variables
that they may refer to at some point in the program. If the sets for two
pointers are found to intersect, then both pointers are assumed to point to
the union of the two sets.
2-10
is 3.
val
may alias each other.
and
can ever point to the same array.
a
b
VisualDSP++ 3.5 C/C++ Compiler and Library Manual
and try to
fn
for ADSP-219x DSPs
,
[]
Need help?
Do you have a question about the VISUALDSP++ 3.5 and is the answer not in the manual?
Questions and answers