HP aC++/HP C Programmer's Guide (B3901-90036; A.06.26; September 2011)
p = new(THIS_FILE, 498) BYTE[50];
}
On HP aC++, the following error is generated:
Error: File “DDB4269.C”, Line 10
Expected 1 argument(s) for void *operator new [ ](unsigned int); had 3 instead.
Parentheses in Static Member Initialization List
In HP C++, redundant parentheses are allowed in a static member initialization list. In
HP aC++, redundant parentheses in a static member initialization list generate an error
and the program does not compile. You must remove the redundant parentheses to
compile the program with both compilers.
Example:
class A {
public:
int i;
static int (A::*p);
};
int (A::*(A::p)) = &(A::i);
Compiling this code HP aC++ generates the following error:
Error: File “DDB4270.C”, Line 7
A pointer to member cannot be created from a parenthesized or unqualified name.
To successfully compile the code, remove the parentheses from the last line.
Example:
class A {
public:
int i;
static int (A::*p);
};
int (A::*(A::p)) = &A::i;
&qualified-id Required in Static Member Initialization List
In HP C++, you can use an unqualified function name in a static member initialization
list. In HP aC++, an unqualified function name in a static member initialization list causes
an error and the program does not compile. Use the unary operator & followed by a
qualified-id in the member initialization list. The resulting code compiles correctly with
HP C++ and HP aC++.
Example:
class A {
public:
int i;
int j();
static int (A::*p)();
272 Migrating from HP C++ (cfront) to HP aC++