Jump to content
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
HP.com home

Transition Impacts

Tru64 UNIX Software Transition Kit
» 

DSPP Home

» HP STK home
Tru64 UNIX STK
» Home
» Overview
» Tools
» Documentation
» Transition impacts
» Identifier types
» Impact list
» Porting to HP-UX
» FAQ
» Glossary
» Help
» Send us feedback
Site maps
» Tru64 UNIX STK
» DSPP
Content starts here

critical impact:

C++ compiler -nostdnew command option - not available (CrUn329)

CC Impacts

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

Command Arguments-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
Printable version
Privacy statement Using this site means you accept its terms Feedback to DSPP
© 2007 Hewlett-Packard Development Company, L.P.