critical impact:
C++ compiler -nostdnew command option - not available (CrUn329)
Problem description
The C++ compiler -nostdnew command option is supported on Tru64 UNIX but not on HP-UX.
The -nostdnew C++ compiler command option generates calls to the pre-ANSI new implementation; this is the default when compiling -std arm, -std cfront, and -std ms. On memory allocation failure, the ANSI implementation throws std::bad_alloc while the pre-ANSI implementation returns 0. Identifiers
 -nostdnew |
|
|
|
|
See also
Solution description
Please review your code for cases that depend on this option, and use the pseudocode example provided to assist in modifying your code to work on HP-UX.
New behavior
The following pseudocode example is provided to assist you in modifying your code to adhere to the ANSI implementation of new:
Old style:
int *i = new int;
if (i) {
// use i...
} else {
// recover from failure to allocate i ...
}
Standard style:
try {
int *i = new int;
// use i...
}
catch () {
// recover from failure to allocate i ...
}
The following example shows how to use the old style in a standard compiler without -nostdnew:
int *i = new(std::nothrow) int;
if (i) {
// use i...
} else {
// recover from failure to allocate i ...
}
See also
Problem summary
| classifications |
source types |
OS release |
severity |
type |
| CC |
Make, Script |
any HP-UX 11i version |
critical |
unavailable |
|