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

New Features in Version A.03.27

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

New features in HP aC++ version A.03.27 are listed below.

Rogue Wave Standard C++ Library 2.2.1

The Rogue Wave Standard C++ Library 2.2.1 (libstd_v2) is now bundled with HP aC++. This library includes the standard iostream library and has namespace std enabled.

To use the new library, you must specify the -AA command line option. Note the following:

  • The +A option is not supported with -AA and may give various link or run-time errors.

  • The Rogue Wave Tools.h++ Version 7.0.6 library cannot be used with -AA.

  • The prior library (Rogue Wave Standard C++ Library 1.2.1) is the default.

  • The prior libraries (Rogue Wave Standard C++ Library 1.2.1 and Rogue Wave Tools.h++ Version 7.0.6) are not compatible with the 2.2.1 library. Code compiled without -AA is incompatible with code compiled with -AA.

Common Migration Problem When Using -AA Option

The following example shows a common problem when using the -AA option. The result of using the new overloads of strchr (on a const char*) is now a const char*. Error 440 results if “p” is not declared as a const char*.

 #include <string.h>
int main() {
char *p = strchr(“abc”, ‘c’);
}

$ aCC -c strchr.c
$ aCC -c strchr.c -AA
Error 440: “strchr.c”, line 3 # Cannot initialize ‘char *’ with
‘const char *’. char *p = strchr(“abc”, ‘c’);
^^^^^^^^^^^^^^^^^^

Transitioning from the Prior to the New Standard C++ Library

The following topics discuss changes when transitioning from the prior version to the new Standard C++ library:

Source Code Changes

Since the new Standard C++ Library (libstd_v2) includes the new iostream library and has namespace std enabled, significant changes may be required in your source code. For example, the following program will no longer compile:

      #include <iostream>      // ported from <iostream.h>
int main() {
cout << “Hello, World” << endl;
}

Because both cout and endl are now in namespace std, they must be referenced as std::cout and std::endl. Alternatively, using declarations or using directives can be added to your code to make them visible outside of the namespace std scope. The following is correct:

      #include <iostream>
int main() {
std::cout << “Hello, World” << std::endl;
}

iostream_compat Directory

To help with code transition to the new C++ standard, an iostream_compat directory is provided. It contains some header files that are just wrappers. You can include files in the iostream_compat directory even when specifying the -AA option, to make symbols like cout visible in global scope.

For example, <iostream.h> is in iostream_compat, and it includes the new <iostream> header followed by a using directive (using namespace std). So the following program will also compile, with warning 890:

 #include <iostream.h>
int main() {
cout << “Hello, World” << endl;
}

To turn off the warning, specify the +W890 command line option.

NOTE: In general, you are encouraged to use header names as specified in the C++ standard. We do not guarantee the inclusion of non-standard compliant headers in our future releases. See the C++ international standard for detailed language rules.

Threads

As with prior compiler releases, one version of libstd_v2 is provided for use with both threaded and non-threaded code. To compile threaded applications, macro -D_RWSTD_MULTI_THREAD must be used. -D_THREAD_SAFE is no longer needed.

See HP aC++ Online Programmer’s Guide for more information.

Limitations

USL’s Standard Components Library (lib++.a) is not and will not be available with -AA.

Incremental Linking in 64-bit Mode

In the edit-compile-link-debug development cycle, link time is a significant component. With incremental linking, any unchanged object files can be reused without being reprocessed. Incremental linking allows you to insert object code into an output file (executable or shared library) that you created earlier, without relinking any unmodified object files. Time required to relink after the initial incremental link depends on the number of modules you modify.

To use incremental linking, specify the +ild option on the aCC command line. If the output file does not already exist or if it was created without the +ild option, the linker performs an initial incremental link. The output file produced is suitable for subsequent incremental links.

The +ild option is valid in 64-bit mode for both executable and shared library links. The +ild option is not valid for relocatable links, options (or tools) that strip the output module, and with some optimization options.

In certain situations (for example, when internal padding space is exhausted), the incremental linker must perform an initial incremental link. You can avoid such unexpected initial incremental links by periodically rebuilding the output file with the +ildrelink option.

You can debug the resulting executable or shared library produced by the incremental linker using the WDB debugger with incremental-linking support.

See Online Linker and Libraries User’s Guide (ld +help) and ld(1) manpage for more information.

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