HP aC++/HP C Programmer's Guide (B3901-90036; A.06.26; September 2011)

int S:: f( ) { return 1;}
main() {
return 1; }
Using :: in Class Definitions
In HP C++, you can declare members of classes inside the class using the following
incorrect syntax:
class_name::member_name
In HP aC++, this incorrect syntax is considered an error. You must remove the
class_name:: specification from the member definition.
Example:
Compiling the following code on HP C++ does not generate a warning or an error.
Compiling the code on HP aC++ generates an error stating that you cannot qualify
members of class X in the class definition.
class X{
int X::f();
// int f(); // This will fix the problem and
// run successfully on both compilers.
>
int main(){
}
Duplicate Formal Argument Names
In HP C++, duplicate formal argument names are allowed. In HP aC++, duplicate formal
argument names generate an error. To avoid this, use unique formal parameter names.
Example:
The following code compiles with HP C++. With HP aC++, an error is generated stating
that symbol aParameter has been redefined and where it was previously defined.
int a(int aParameter, int * aParameter);
Ambiguous Function or Object Declaration
In HP C++, an ambiguous function or object declaration compiles without warning,
assuming an object declaration. In HP aC++, an ambiguous function or object declaration
generates an error. To change this, change the code to remove the ambiguity.
Example:
struct A {A(int);};
struct B {B(const A &); void g();};
void f(int p) {
B b(A(p)); // Declaration of function or object?
b.g(); // Error?
}
Migration Considerations Related to Standardization 269