HP Code Advisor Diagnostics

Check if you actually want to convert from the derived to base type. If yes, then provide an
explicit cast: Base *b = (Base*) new Derived;
Reference:
ANSI/ISO C++ 8.3.2 (4)
2276 name followed by :: must be a class or namespace name
Cause:
The qualifier type preceding :: is not declared or defined as a class or a namespace.
Example: T::type i;
Action:
Make sure that the declaration or definition of the class or the namespace is defined before it is
used. Check if the necessary header files containing the declaration/definition are included.
Reference:
2278 a constructor or destructor may not return a value
Cause:
Constructors and destructors do not have a return type and they do not return any value. It is
incorrect to provide a return statement for constructors and destructors.
Example:
struct Base {
Base() { return 0; }
};
Action:
Remove the return statement, for example: Base() { }
Reference:
2306 default argument not at end of parameter list
Cause:
Default arguments can only be provided at the end of the parameter list. All the parameters
following a parameter with default argument must also have default arguments.
Example: void print(int argc = 0, char **argv);
Action:
Remove the given default arguments, or provide default arguments to all the parameters following
that parameter or rearrange the parameter list. For example: void print(int argc, char **argv); //
or void print(int argc = 0, char **argv = 0); // or void print(char **argv, int argc = 0);
Reference:
ANSI/ISO C++ 8.3.6 (4)
2314 only nonstatic member functions may be virtual
Cause:
Only non-static member functions can be declared as virtual, static members functions cannot
be virtual.
Example:
class Base {
virtual static void vfoo() {}
42 Diagnostics Details