Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP-UX Systems: HP aC++ Release Notes > Chapter 1 HP aC++ Release Notes

What’s in This Version

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

This section gives an overview of the new features introduced in this version of the HP aC++ compiler.

New Features in Version A.03.70

Following are the new features in HP aC++ version A.03.70:

  • The HP Code Advisor, a source code analysis tool

  • The -fshort-enums command-line option

  • The _HP_NONSTD_FAST_IOSTREAM performance improvement directive

  • The +rodata_array_init Option for Memory efficient initialization for local arrays

  • Option mapping support for easy migration

  • Configuration file to set sitewide default options

  • C++ Standard Library Change

The HP Code Advisor, a source code analysis tool

This release introduces a new tool, HP Code Advisor (cadvise) that enables programmers to detect various programming errors in C and C++ source code. This tool helps you to identify potential coding errors, porting issues, and security errors.

You can invoke this tool from /opt/cadvise/bin/cadvise in the command line. For more information on how to use the various options in this tool, see the HP code Advisor Release Notes.

The updated version of the HP Code Advisor is also available for free download at:

http://www.hp.com/go/cadvise

The -fshort-enums Command-Line Option

This new command-line option allocates only as many bytes as required for the declared range of possible values to an enum type. The enum type is equivalent to the smallest integral type, which has enough memory space for the declared enumerator range.

NOTE: Using -fshort-enums causes the compiler to generate code that may be binary incompatible with the code generated without this option. To generate compatible code, do not use or define external enumerators (defined or used in other source files or shared libraries) that are compiled without this option.

The _HP_NONSTD_FAST_IOSTREAM Performance Improvement Directive

HP aC++ A.03.70 has a new performance improvement preprocessor directive, -D_HP_NONSTD_FAST_IOSTREAM, which improves the iostream performance. This directive enables the following non-standard features:

  • Sets ios_base::sync_with_stdio(false), which disables the default synchronization with stdio.

  • Sets std::cin.tie(0), which unties the cin from other streams.

  • Replaces all occurrences of "std::endl" with "\n".

Enabling this directive might result in noticeable performance improvement, if the application uses iostreams more often.

NOTE: Do not enable -D_HP_NONSTD_FAST_IOSTREAM directive in any of the following cases:
  • If the application assumes C++ stream to be in sync with C stream

  • If the application depends on stream flushing behavior with endl

  • If the user uses "cout.unsetf(ios::unitbuf)" to unit buffer the output stream.

The +rodata_array_init Option for Memory Efficient Initialization for Local Arrays

A new command-line option, +rodata_array_init is added in HP aC++ A.03.70 to enable memory efficient initialization for local arrays.

When you use this option, the compiler allocates the local array initializers (that it generates for initialized local arrays) to the read-only data section. By default, these initializers are allocated to the data section.

NOTE: If the array is initialized with addresses, this option can cause an increase in run time. The increase is based on the number of addresses in the array initializer and the number of times the array is initialized. This overhead is normally negligible.

Option Mapping Support for Easy Migration

The option mapping support available in HP aC++ A.03.70 facilitates easy migration of build environment from a different compiler to HP aC++. You can use the option mapping files to map the options in the third party compilers to HP aC++ equivalents

Mapping File:

The mapping file is a text file that defines the mapping rules. The compiler reads the mapping file and applies the specified replacements to the options on the command line. This minimizes the need to make Makefile or script changes. By default, the path for the mapping file is set to the following location:

/opt/aCC/lib/option.map

You may either define the mapping rules in this file or set the mapping file path to an alternate location. To specify an alternate location, set the CXX_MAP_FILE environment variable, like the following example:

export CXX_MAP_FILE=/home/src/my_option.map (sh/ksh)
setenv CXX_MAP_FILE /home/src/my_option.map (csh)

where:
my_option.map is the name of the new mapping file.

To disable the use of the mapping file (in spite of having one in the default location), set the above environment variable to NULL, like the following example:

export CXX_MAP_FILE=    (sh/ksh)
export CXX_MAP_FILE=""  (sh/ksh)
setenv CXX_MAP_FILE ""    (csh)

Defining the Mapping Rules:

Following is the syntax for defining the rules in the mapping file:

LHS => RHS           (Note the space before and after "=>")

Where:
        LHS is the third party compiler optio.
    RHS is the HP aC++ compiler option

To define rules for options that have arguments, use the $<number> wildcard. For example, $1 for the first argument, and $2 for the second. If the third party compiler option (LHS) does not match with any HP aC++ option, leave the RHS blank.

Example Rules:

The following example rules map gcc compiler options to corresponding HP aC++ compiler options. The same rules can be used for mapping options from any third party compiler. The syntax for the rule becomes as follows:

gcc_option => hp_option
  • -Wtraditional =>
    Ignores (removes) -Wtraditional, a gcc option from the command line.

  • -shared => -b
    Replaces -shared with -b at the command line.

  • -rpath-link $1 =>
    Deletes -rpath-link and the arguments from the command line.

  • --gccopt $1=$2 => -hpopt $2
    Replaces “--gccopt option=name" at the command line with "-hpopt name".

  • -gccopt $1 => +xyz
    Replaces "-gccopt optionarg" at the command-line with "+xyz".

  • -Bstatic => -a archive -noshared
    Replaces "-Bstatic" with "-a archive -noshared".

Configuration File to set Site-wide Default Options

You can specify default sitewide options for HP aC++ in a configuration file. On startup, HP aC++ reads, and applies the default options from the file if the file is found and readable. No default options are set if the file is not found or readable.

The default path of the configuration file is set to the following locations:

/var/ansic/share/cc.conf       in C mode
/var/aCC/share/aCC.conf           in C++ mode

To change the path of the configuration file, use the following environment variables:

CC_CONFIG       in C mode
CXX_CONFIG in C++ mode

The options in the configuration file can be specified in the same format as that for CCOPTS and CXXOPTS.

[options-list-1][<vbar> [options-list-2]]

Where:
       options-list-1 is applied before the options in the command line
       options-list-2 is applied after the options in the command line
        <vbar> is |

The final option ordering is as follows:

<file-options-1><envvar-options-1><commandline-options> <envvar-option s-2><file-options-2>
NOTE: No default configuration files are shipped with HP aC++. The system administrator can create them, if required.

C++ Standard Library Change

Technical Corrigenda 1 (TC1) of the ANSI/ISO C++ Standard has changed the STL function make_pair to take their arguments by value instead of const reference. This change brings the HP library into compliance if the enabling macro -D__HP_TC1_MAKE_PAIR is specified at compile time. For binary compatibility reasons, the default behavior is unchanged.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 2006 Hewlett-Packard Development Company, L.P.