HP aC++/HP C A.06.20 Programmer's Guide

int f(int i);
overload int f(float f); // Remove the word overload.
int main () {
return 1;
}
Dangling Comma in enum
In HP C++, a comma following the last element in an enum list is ignored. In HP aC++,
a comma following the last element in an enum list generates an error. To avoid this
error, remove the comma after the last element.
Example:
HP C++ accepts the following code. HP aC++ generates an error stating that the comma
(,) is unexpected.
enum Colors { red,
orange,
yellow,
green,
blue,
indigo,
violet, // This comma is illegal.
};
Static Member Definition Required
In HP C++, you can declare a static member and not define it. However, in HP aC++,
you cannot do so. You must define the declared static data member.
Example:
Compiling and linking the following code on HP C++ gives no warning nor error.
Compiling the code on HP aC++ gives neither a warning nor an error. Linking the
resulting object file generates a linker (ld) error that states that there are unsatisfied
symbols.
class A {
public:
static int staticmember;
};
// int A::staticmember=0; // This would fix the problem.
int main ()
{
A::staticmember=1;
}
Declaring friend Classes
In HP C++, you can declare friend classes without the class keyword. In HP aC++,
declaring friend classes without the class keyword generates an error. To change
this, add the class keyword to all friend class declarations.
Migration Considerations Related to Standardization 279