HP OpenVMS Systems

C++ Programming Language
Content starts here HP C++

HP C++

User's Guide for OpenVMS Systems

Order Number: AA-RPM8D-TE

June 2006

This manual contains information about developing HP C++ programs on OpenVMS systems and describes related language features.

Revision/Update Information: This revised guide supersedes
User's Guide for OpenVMS Systems Order No. AA-RPM8C-TE, Version 7.1.

Operating System and Version: OpenVMS I64 Version 8.2 or higher
OpenVMS Alpha Version 7.3-2 or higher

Software Version: HP C++ Version 7.2 for OpenVMS Systems

Hewlett-Packard Company Palo Alto, California

© Copyright 2006 Hewlett-Packard Development Company, L.P.

Confidential computer software. Valid license from HP required for possession, use or copying. Consistent with FAR 12.211 and 12.212, Commercial Computer Software, Computer Software Documentation, and Technical Data for Commercial Items are licensed to the U.S. Government under vendor's standard commercial license.

The information contained herein is subject to change without notice. The only warranties for HP products and services are set forth in the express warranty statements accompanying such products and services. Nothing herein should be construed as constituting an additional warranty. HP shall not be liable for technical or editorial errors or omissions contained herein.

Intel and Itanium are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries.

UNIX is a registered trademark of The Open Group.

X/Open is a registered trademark of X/Open Company Ltd. in the UK and other countries.

Portions of the ANSI C++ Standard Library have been implemented using source licensed from and copyrighted by Rogue Wave Software, Inc.

Information pertaining to the C++ Standard Library has been edited and reprinted with permission of Rogue Wave Software, Inc. All rights reserved.

Portions copyright 1994-2002 Rogue Wave Software, Inc.

Printed in the US

This document is available on CD-ROM. This document was prepared using DECdocument, Version 3.3-1e.

Contents Index


This manual contains information about developing and debugging HP C++ programs on OpenVMS systems, and includes information on other OpenVMS features and tools that work with the compiler.

Intended Audience

This manual is intended for experienced programmers who need to develop HP C++ programs on OpenVMS systems. Users of this manual should have a basic understanding of the C++ language and some familiarity with the Digital Command Language (DCL).

Structure of this Document

This manual is organized as follows:

  • Chapter 1 shows how to create, compile, link, and run HP C++ programs.
  • Chapter 2 describes features and characteristics that are specific to the HP C++ implementation.
  • Chapter 3 describes guidelines and procedures for customizing your language environment.
  • Chapter 4 describes how to make code used with other C++ implementations acceptable to the HP C++ compiler.
  • Chapter 5 describes how to use templates with HP C++.
  • Chapter 6 explains how to use C++ exception handling.
  • Chapter 7 describes the HP C++ implementation of the C++ Standard Library.
  • Chapter 8 explains how to use the OpenVMS Debugger with HP C++.
  • Chapter 9 explains how to use 64-bit address space.
  • Appendix A describes compiler command qualifiers.
  • Appendix B provides information on using programming tools with HP C++.
  • Appendix C describes built-in functions.
  • Appendix D describes Class Library restrictions.

Associated Documents

The following documents contain information associated with topics in this manual:

  • Stroustrup, Bjarne. The C++ Programming Language, 3rd Edition. Reading, Massachusetts: Addison-Wesley, 1997.
    This text combines a user guide and language reference manual to provide an exhaustive introduction to the C++ programming language, including sophisticated language features. Where appropriate, section numbers shown in parentheses (for example, §r.2.3) refer to relevant portions of The C++ Programming Language, 3rd Edition.
  • HP C++ Class Library Reference Manual
    This manual describes a library of HP C++ classes.
  • HP C++ Installation Guide for OpenVMS Alpha
    This document supplies the information necessary to install HP C++ on OpenVMS Alpha systems.
  • HP C++ Installation Guide for OpenVMS I64
    This document supplies the information necessary to install HP C++ on OpenVMS I64 systems.
  • HP C Run-Time Library Reference Manual for OpenVMS Systems
    This library manual provides information, useful to HP C++ users, on the OpenVMS Run-Time Library (RTL) for C functions and macros, which include the ANSI C standard library. This manual also contains information about porting programs to and from other operating systems.

The C++ Programming Language, 3rd Edition and the STL Tutorial and Reference Guide are available only in printed form. Online copies are not available.

Related Documents

  • Carroll, Martin D. and Margaret E. Ellis. Designing and Coding Reusable C++. Reading, Massachusetts: Addison-Wesley, 1995.
    This text provides practical information for designing and implementing C++ programs.
  • Myers, Scott. Effective C++: 50 Specific Ways to Improve Your Programs and Designs, 3rd edition. Reading, Massachusetts: Addison-Wesley, 1997.
  • Myers, Scott. More Effective C++: 35 New Ways to Improve Your Programs and Designs. Reading, Massachusetts: Addison-Wesley, 1995.
    These texts provide practical information for designing and implementing C++ programs.
  • International Standard ISO/IEC 14882
    Defines the C++ International Standard. The document is available for downloading at the ANSI Electronic Store (start at http://www.ansi.org ).
    The printed version is also available for purchase from the same web site. Choose "Catalogs/Standards Information", then "ANSI-ISO-IEC Online Catalog", then search for "14882".

Conventions Used in this Manual

Table 1 lists the conventions used in this manual.

Table 1 Conventions Used in this Manual
Convention Meaning
class complex {
A vertical ellipsis indicates that some intervening program code or output is not shown. Only the more pertinent material is shown in the example.
,... A horizontal ellipsis in a syntax description indicates that you can enter additional parameters, options, or values. A comma preceding the ellipsis indicates that successive items must be separated by commas.
The generic class...
The get() function...
Monospaced type denotes the names of HP C++ language elements, and also the names of classes, members, and nonmembers. Monospaced type is also used in text to reference code elements displayed in examples.
italic Italic type denotes the names of variables that appear as parameters or in arguments to functions, and also denotes book titles.
boldface Boldface type in text indicates the first instance of terms defined in text.

Platform Labels

This guide contains information applicable to the HP OpenVMS operating system on Alpha and Intel Itanium processors. The information in this guide applies to both of these processors, except when specifically labeled as follows:

(ALPHA ONLY) Specific to the OpenVMS operating system running on an Alpha processor.
(I64 ONLY) Specific to the OpenVMS operating system running on an Intel Itanium processor. On this platform, the product name of the operating system is OpenVMS for Industry Standard 64 for Integrity servers (abbreviated in this manual as OpenVMS I64 or I64).

New and Changed Features in C++ I64 Version 7.2

Some of the new or changed features supported by this version of the compiler are:

  • 64-bit pointer support is added for C++ I64.
    This support is compatible with the 64-bit pointer support in the C++ and C compilers for OpenVMS Alpha. It supports the same /POINTER_SIZE command-line qualifier, the __INITIAL_POINTER_SIZE predefined macro, and the same pragmas ( #pragma pointer_size and #pragma required_pointer_size ). Please see the C++ V7.2 release notes for more information on 64-bit pointer support for the I64 compiler.
  • Variadic macros are now supported.
    This feature allows macros to take a variable number of arguments. It was added to HP C Version 6.4 and is supported by a number of other C and C++ compilers. This feature is available only when the value of the /STANDARD qualifier is RELAXED (the default), MS, or GNU.
  • Support is added for generation of a new section type in the object file that maps mangled names to their original unmangled form.
    Future versions of the linker will take advantage of this feature by using the demangled spelling of an identifier name for its error messages. In addition, the linker will be able to generate a new section in the linker map that shows mangled names and their corresponding unmangled orginal name.
  • Prologue and epilogue file header processing is now supported in HP C++.
  • The __FUNCTION__ identifier is added.
    __FUNCTION__ is a predefined pointer to char defined by the compiler, which points to the name of the function as it appears in the source program. __FUNCTION__ is same as __func__ of C99.

New and Changed Features in Version 7.1

HP C++ Version 7.1 runs on OpenVMS Alpha and OpenVMS Integrity servers. The compiler behaves much the same on both systems, with some differences, primarily in the support for built-in functions, default floating-point representation, and predefined macros. These differences are noted in the relevant sections of this manual.

Some of the new or changed features supported by this version of the compiler on both Alpha and I64 systems are:

  • cname header support is added ( Section 3.1).
    The C++ compiler implements section - Headers [lib.headers] "C++ Headers for C Library Facilities" of the C++ Standard.
    The implementation consists of 18 <cname> headers defined in the Standard (Chapter 3). As required by the C++ standard, the <cname> headers define C names in the std namespace.
    The /[NO]PURE_CNAME qualifier is added to control insertion of the names by <cname> headers into the std namespace only (/PURE_CNAME), or into the std namespace and the global namespace (/NOPURE_CNAME).
  • The /[NO]FIRST_INCLUDE=(file[,...]) qualifier is added (Appendix A).
    This qualifier includes the specified files before any source files. It corresponds to the Tru64 UNIX -FI switch.
  • The #pragma include_directory preprocessor directive is added ( Section
    This pragma is intended to ease DCL command-line length limitations when porting applications from POSIX-like environments built with makefiles containing long lists of -I options that specify directories to search for headers.
  • Changes are made to the /WARNING qualifier and compiler messages ( Section 2.5).
    Changes to the /WARNINGS qualifier include bug fixes and improved compatibility with the C compiler. Some changes that might affect user compilations are:
    • The /WARNINGS=ENABLE=ALL qualifier now enables all compiler messages including informational-level messages.
    • The /WARNINGS=INFORMATIONALS qualifier continues to enable most informationals, but we recommend that /WARNINGS=ENABLE=ALL be used instead
    • Using /WARNINGS=INFORMATIONALS=<tag> no longer enables all other informational messages.

    Also, some compiler diagnostics might be different on Alpha and I64 systems, and some conditions detected on one platform might not be detected on the other.
  • A new C++ front end is added to provide improved conformance to the C++ International Standard.
  • Support for /STANDARD=CFRONT is retired.

Reader's Comments

You may send comments or suggestions regarding this manual, or any HP C++ document, by electronic mail to the following Internet address:


Product Support

Premium support is available on a per-incident basis


and annual contracts


from HP Services in the US and some other countries. In the US and Canada, call, toll-free, 1-800-354-9000. In other countries, support phone numbers are available on the web at:


Free support is limited to bug reports that can be sent to

Send a complete but short example reproducing the problem, including the following:

  • Compiler and operating system versions
  • All necessary sources (such as INCLUDE files and module sources)
  • Data files
  • Commands used to compile, link and run the program
  • Expected results and incorrect results obtained

Please try to reduce the problem to as small a source as possible, because we may be unable to diagnose large applications.

We answer most quickly those problem reports that include a small but complete reproducible example, along with descriptions of the compile and link options used and the exact text of any diagnostic messages or other incorrect results. Reports that include only program fragments or involve very large applications generally will not be accepted.

Please note that this is not a "programming consulting service" and that you should have clear evidence of a product problem before contacting us. If you need consulting services, please contact HP Services.

Next Contents Index