HP Code Advisor Diagnostics

2815 type qualifier on return type is meaningless
Cause:
A type qualifier has been used as part of a funtion's return type. The type qualifiers have no
meaning for function return values.
Example: const int foo() { return 10; }
Action:
Remove the type qualifier in the return type of the function.
Reference:
2826 %n was never referenced
Cause:
This function definition contains a parameter n that was never referenced.
Example: int foo( int i) {
return 0;
}
Action:
Examine your code to determine if this function parameter is needed in this function.
Reference:
2830 %n has no corresponding operator delete%s (to be called if an
exception is thrown during initialization of an allocated object)
Cause:
For operator new, a corresponding operator delete needs to be provided so that it can be called
for proper destruction in case an exception is thrown during the initialization of the allocated
object.
Example:
void* operator new(unsigned long, void*) { return 0; }
struct Pool {
Pool() { }
} object;
Pool* allocate() { return new (&object) Pool(); }
Action:
Provide a corresponding operator delete to be called if an exception is thrown during the
initialization of the allocated object.
Reference:
2836 returning reference to local variable
Cause:
It is incorrect to return a reference to a local variable as the return value from a function. This is
because the lifetime of a local variable ends once the function returns.
Example:
int& foo() {
int i = 10;
return i;
}
50 Diagnostics Details