HP Code Advisor Diagnostics Reference Guide (5900-1865, July 2011)
Remove the unnecessary storage class specifier.
Reference:
ARM 7.1.1.
2.89 3051 standard requires that %n be given a type by a subsequent
declaration (\"int\" assumed)
Cause:
The parameter of an old-style function definition was not declared. It will default to int type. Omitting
the type specifier is not valid in C99.
Example:int foo(arg) { return arg; }
Action:
Declare the parameter. Preferable old-style function definitions should be replaced by
prototype-format definitions.
Reference:
C99 6.9.1
2.90 3055 types cannot be declared in anonymous unions
Cause:
Anonynous unions can only define non-static data members. You cannot declare types or functions
within anonymous unions.
Example:
static union {
typedef int T;
T i;
};
Action:
Remove the typedef from the anonymous union. Either declare the members without the typedef
type or provide the typedef outside the anonymous union. For example: static union { int i; };
Reference:
ANSI/ISO C++ 9.5(2)
2.91 3056 returning pointer to local variable
Cause:
The return value of the function is the address of a local variable. Unless declared as static, a local
variable has automatic storage duration i.e. the storage for it lasts until the block that defines it
exists. Dereferencing the pointer to a local variable after the function that defines it returns will
lead to undefined runtime behavior.
Example:
int* foo() {
int i = 10;
return
}
Action:
If you need to return the pointer to this variable then make it a static variable.
Reference:
ANSI/ISO C++ 3.7.2
2.89 3051 standard requires that %n be given a type by a subsequent declaration (\"int\" assumed) 49