HP Code Advisor Diagnostics

int print(char *str,void *fmt, ...)
__attribute__((format(printf,2,3))); // argument 2 must be of
// string type
Action:
Where possible use the promoted type instead
Reference:
ANSI/ISO C++ 5.2.2(7)
3197 the prototype declaration of %nfd is ignored after this unprototyped
redeclaration
Cause:
The unprototyped declaration of a function in an inner scope hides an prototyped declaration
in the outer scope. NOTE: In same scope the function prototypes do not hide each other but in
nested scope they do.
Example:
int foo(int x);
int main() {
int foo(); // warning 3197 here
}
Action:
Remove the unprototyped declaration.
Reference:
3290 Passing a non-POD object to a function with variable arguments has
undefined behavior. Object will be copied onto the stack instead of using
a constructor.
Cause:
A non-POD (POD stands for "plain old data") object is being passed to a function with variable
arguments. Object will be copied onto the stack instead of using a constructor.Varargs do not
know how to deal with non-POD types, this can lead to undefined behavior.
Example:
class A {
int i;
};
int foo(char*, ...);
int bar() {
A a;
foo("hello",a);
return 0;
}
Action:
Do not pass non-POD object to a function with variable arguments. If this is essential write a
conversion operator to convert from non-POD to POD type and call that operator before passing
the object to the variable arguments function.
Reference:
54 Diagnostics Details