HP Code Advisor Diagnostics Reference Guide (5900-1865, July 2011)

Check if all the execution paths leading to the usage of reported variable initialize it. To avoid
such issues it is best to initialize the variable close to the point of declaration.
Reference:
2.159 20048 %s "%s" has incompatible type with previous declaration
at line %s in file "%s"
Cause:
The declaration of a global variable or function does not match the corresponding declaration on
a different file.
Example:
-- file1.c ----
typedef struct {
int f;
int g;
} A;
A global; // LINE 6
void print_A(A par) // LINE 8
{
printf("%d %d", par.f, par.g);
}
-- file2.c ----
typedef struct {
int f;
char g; // Should be: int g;
} A;
A global;
void print_A(A);
main()
{
print_A(global);
}
"file1.c", line 8: warning #20048-D: Function "print_A" has incompatible
type with previous declaration at line 8 in file "file2.c"
"file2.c", line 6: warning #20048-D: Variable "global" has incompatible
type with previous declaration at line 6 in file "file1.c"
Action:
In the case of mismatch for a global variable, review the 2 locations specified in the warning and
make sure that the declared global types match. In the case of a function, review the 2 locations
specified in the warning and verify that the types of the arguments and return value match for the
two function declarations. This problem can usually be avoided by using header files to declare
types or functions used across multiple source files.
Reference:
2.160 20072 variable %s is partially uninitialized when used
Cause:
An element in an array or a field of a struct is being referenced prior to its initialization.
Example:
int a[10];
a[9] = 12;
foo(a); // warning 20072: elements 0-8 are uninitialized
Action:
Ensure that all elements/fields of an array/struct are initialized prior to passing it as a function
argument. .
Reference:
2.161 20073 variable %s may be partially uninitialized when used
Cause:
72 Diagnostics Details