HP-UX Cadvise Diagnostics Reference Guide (5900-1865, August 2012)

Table Of Contents
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() {}
};
Action:
Make the member function either static or virtual, for example: virtual void vfoo() {}
Reference:
2315 the object has cv-qualifiers that are not compatible with the member
function
Cause:
The cv qualifiers ( const and volatile qualifiers) of the object should be compatible with the cv
qualifiers of member functions that it calls. For example, any attempt to call a non-const member
function on a const object will result in an error.
Example:
int main() {
struct X {
2278 a constructor or destructor may not return a value 39