Digital Equipment Corporation
Maynard, Massachusetts
The information in this document is subject to change without notice and should not be construed as a commitment by Digital Equipment Corporation. Digital Equipment Corporation assumes no responsibility for any errors that may appear in this document.
The software described in this document is furnished under a license and may be used or copied only in accordance with the terms of such license.
No responsibility is assumed for the use or reliability of software on equipment that is not supplied by Digital Equipment Corporation or its affiliated companies.
Restricted Rights: Use, duplication, or disclosure by the U.S. Government is subject to restrictions as set forth in subparagraph (c)(1)(ii) of the Rights in Technical Data and Computer Software clause at DFARS 252.227-7013.
The following are trademarks of Digital Equipment Corporation: Alpha, Bookreader, DEC, DECnet, Ladebug, DECthreads, OpenVMS, VAX, VAX DOCUMENT, VMS, and the DIGITAL logo.
PostScript is a trademark of Adobe Systems Incorporated.
UNIX is a registered trademark in the United States and other countries licensed exclusively through X/Open Company Ltd.
Contents |
This document contains the release notes for DIGITAL C++ Version 6.0 for DIGITAL UNIX Systems.
This kit installs two compilers:
The ladebug version installed by this kit is 4.0-44.
HTML files are provided for the release notes and some of the product manuals for use with a web browser. You can install these files by selecting the subset DIGITAL C++ HTML documentation.
To view this documentation, open the following file using your web browser:
/usr/share/doclib/cplusplus/cxx.html |
Starting with Version 6.0, the DIGITAL C++ compiler differs significantly from previous versions. There are several major differences that you should be aware of before using a Version 6 compiler for the first time. These differences are summarized here and discussed in more detail in Section 1.3.11.
If Version 6.n requires excessive changes to your applications
even when you use the -std arm option, or
if you encounter problems using the Version 6.0 compiler, you can
compile using the cxx -oldcxx command.
See Section 1.3.10.
1.3 Enhancements and Changes in Version 6.0
This section briefly summarizes changes and enhancements made in Version 6.0.
Section 1.3.11 discusses compatibility issues that you might encounter in
using Version 6.0 if you have used Version 5.n in the past.
1.3.1 Language Mode Options
With Version 6.0, DIGITAL C++ supports the Final Draft International Draft ANSI C++ standard (FDIS). DIGITAL C++ releases prior to Version 6.0 implemented the ARM (The Annotated C++ Reference Manual, 1991, by Ellis and Stroustrup) with some ANSI C++ extensions. The FDIS ANSI C++ language standard differs in significant ways from the language implemented by DEC C+ Version 5.n. The default language mode for Version 6.0 is ANSI, and many programs developed using Version 5.n require modifications before they can be compiled in the default ANSI mode. Version 6.0 also supports an ARM language mode for greater compatibility with previous versions.
Version 6.0 provides the following language mode options:
-std ansi
Specify this option if you want an ANSI C++ compiler that supports some commonly used extensions and is somewhat less strict than the standard. This is the default compiler mode.If you want to use ANSI mode but find that the compiler generates too many diagnostics in that mode, you can use the -msg_quiet option with the -std ansi option. The -msg_quiet option relaxes error checking and suppresses or reduces the severity of many diagnostics. It also suppresses many warnings that are generated in ANSI mode but were not issued by Version 5.6. For information on message control options, see Section 1.3.2.
-std arm
Specify this option if you want to compile programs developed using DIGITAL C++ Version 5.n and want to minimize source changes.If you usually want your compilations done in this mode and don't want to specify -std arm on each cxx command, define environment variable DEC_CXX as follows:
setenv DEC_CXX "-std arm"See Section 1.3.9 for more information on environment variable DEC_CXX.
DIGITAL C++ Version 6.0 also provides support for other C++ dialects and language modes. You can specify the following options:
-std ms
Specify this option if you want the compiler to accept additional Microsoft Visual C++ extensions.-std cfront
Specify this option if you want to compile programs developed using cfront or a compiler based on cfront.-std strict_ansi
Specify this option if you want the compiler to enforce the ANSI C++ standard strictly. The default ANSI mode permits some common extensions and provides less strict error checking than the strict_ansi_errors mode.-std strict_ansi_errors
Specify this option if you want strict_ansi and also want errors to be issued for all ANSI violations.
With either -std ms or -std cfront you may also want to specify -msg_quiet to reduce the number of diagnostic
messages generated.
1.3.2 Message Control Options
DIGITAL C++ V6.0 supports the following message control options. The options apply only to discretionary, warning and informational messages. The tag variable is either a tag obtained from -msg_display_tag or a number obtained from -msg_display_number. The tag variable is preferred.
-msg_inform tag,...
Alter message(s) severity to informational.-msg_warn tag,...
Alter message(s) severity to warning.-msg_error tag,...
Alter message(s) severity to error-msg_enable tag,...
Enable specific messages that would normally not be issued when using -msg_quiet. This option can also be used to enable messages disabled with -msg_disable.-msg_disable tag,...
Disable message. This can be used for any "non-error" message.-msg_quiet
Be more like DIGITAL C++ Version 5.n error reporting. Fewer messages are issued using this option.This is the default in arm mode (-std arm). All other modes default to -nomsg_quiet.
You can use the msg_enable option with this option to enable specific messages normally disabled using -msg_quiet.
DIGITAL C++ V6.0 supports the following message information options. Both are off by default.
"D" (meaning discretionary) indicates that the severity of the message can be controlled from the command line. The message number can be used as the tag in the above message control options. If "D" is not displayed with the message number, any attempt to control the message is ignored. |
-msg_display_tag
A more descriptive tag is issued at the end of each message issued. "D" indicates the severity of the message can be controlled from the command line. The tag displayed can be used as the tag in the above message control options.Example:
cxx -msg_display_tag t.cxx cxx: ... is nonstandard ("int" assumed) (D:nonstd_implicit_int) cxx -msg_disable nonstd_implicit_int t.cxxNote that you can change the severity of a diagnostic message if the message is discretionary. For example, -msg_inform nonstd_implicit_int changes the severity this to an informational. These options interact with -w0, -w1, and -w2.
-msg_display_number
The error number is displayed at the beginning of each message issued.Example:
cxx -msg_display_number t.cxx cxx: Warning: t.cxx, line 1: #117-D non-void function "f" ... cxx -msg_disable 117 t.cxx
Note that you can also change the severity of a diagnostic message if
the message is discretionary. For example, -msg_inform 110 changes the severity of message
110 to an informational. These options interact with -w0, -w1, and
-w2.
1.3.4 Standard Library Options
The following are new Standard Library options. For detailed information about the DIGITAL C++ Standard Library, see Using DIGITAL C++ for DIGITAL UNIX Systems.
-[no]using_std
Controls whether standard library header files are processed as though the compiled code were written as follows:
using namespace std; #include <header>These options are provided for compatibility for users who do not want to qualify use of each standard library name with std:: or put using namespace std; at the top of their sources.
-using_std turns implicit using namespace std on; this is the default when compiling -std arm, -std cfront, -std ms, or -std ansi.
-nousing_std turns implicit using namespace std off; this is the default when compiling -std strict_ansi or -std strict_ansi_errors.
-[no]stdnew
Controls whether calls are generated to the ANSI or pre-ANSI implementation of the operator new(). On memory allocation failure, the ANSI implementation throws std::bad_alloc, while the pre-ANSI implementation returns 0.-stdnew generates calls to the ANSI new() implementation; this is the default when compiling -std ansi, -std strict_ansi and -std strict_ansi_errors.
-nostdnew generates calls to the pre-ANSI new() implementation; this is the default when compiling -std arm, -std cfront and -std ms.
-[no]global_array_new
Controls whether calls to global array new and delete are generated as specified by ANSI. Pre-ANSI global array new generated calls to operator new(). According to ANSI, use of global array new generate calls to operator new()[].-global_array_new generates calls to operator new()[] for global array new expressions such as new int[4]; this is the default when compiling -std ansi, -std strict_ansi, -std strict_ansi_errors, and -std ms.
-noglobal_array_new generates calls to operator new() for global array new expressions such as new int[4] and preserves compatibility with Version 5.n; this is the default when compiling -std arm and -std cfront.
You can specify the following options for precompiled headers. For detailed information about precompiled headers, see Using DIGITAL C++ for DIGITAL UNIX Systems.
-pch
Automatically use and/or create a precompiled header file. If -use_pch or -create_pch (manual PCH mode) appears on the command line following this option, the last option is used.-create_pch file-name
If other conditions are satisfied, create a precompiled header file with the specified name. If -pch (automatic PCH mode) or -use_pch appears on the command line following this option, the last option is used.-use_pch file-name
Use a precompiled header file of the specified name as part of the current compilation. If -pch (automatic PCH mode) or -create_pch appears on the command line following this option, the last option is used.-pch_dir directory-name
The directory in which to search for and/or create a precompiled header file. This option may be used with automatic PCH mode (-pch) or manual PCH mode (-create_pch or -use_pch).-[no]pch_messages
Enable or disable the display of a message indicating that a precompiled header file was created or used in the current compilation. The default is -pch_messages.
Version 6.0 provides the following new options for templates. For detailed information about using templates, see Using DIGITAL C++ for DIGITAL UNIX Systems.
-implicit_include
Enable inclusion of source files as a method of finding definitions of template entities. By default it is enabled for normal compilation, and disabled for preprocessing only, -E and -P. The search rules for finding template definition files is the same as for include files.-no_implicit_include
Disables inclusion of source files as a method of finding definitions of template entities. You may want to use this option in conjunction with -ms and -std ms command line options, in order to more closely match the behavior on Microsoft C++.-ttimestamp
Used with automatic instantiation. Causes automatic instantiation to instantiate templates only if they are already in the repository, or if the existing instantiations in the repository are older than the timestamp in the repository.
The Version 6.0 compiler emits type information for run-time type identification (RTTI) in the object module with the virtual function table, for classes that have virtual function tables.
You can specify the following options:
-[no]rtti
Enable or disable support for RTTI (runtime type identification) features: dynamic_cast and typeid. Disabling runtime type identification may also save space in your object file because static information to describe polymorphic C++ types is not generated. The default is to enable runtime type information features and generate static information in the object file.Note that specifying -no_rtti does not disable exception handling.
The type information for the class may include references to the type information for each base class and information on how to convert to each. If the module with the vtable for the base class was compiled with Version 5.n, the base class type information variable will be missing (but not the offset and other information to do the conversion). Because the type information variable is missing, the Version 6.0 compiler emits a tentative definition of the type information for each of its base classes. The correct definition will override if the base class is later compiled with Version 6.0.
The runtime can distinguish invalid type information, and will either return a null pointer in the dynamic cast case, throw bad_cast if dynamic casting to a reference, or throw bad_typeid if calling typeid() on an object whose type information is invalid.
Other triggers to emit type information from classes will emit external references that may not be resolved. For example, if an object is compiled with Version 5.6, and a program compiled with Version 6.0 tries to do a typeid() for that object, an unresolved reference will result.
The typeinfo references are mangled in the form __T__<class>.
1.3.8 Performance Optimization Options
Version 6.0 provides the following performance optimization options:
-[no]ansi_alias
Specifies whether the compiler assumes the ANSI C aliasing rules to generate better optimized code.With the current version, if a program does not access the same data through pointers of a different type (and for this purpose, signed and qualified versions of an otherwise same type are considered to be the same type), then assuming ANSI C aliasing rules allows the compiler to generate better optimized code.
If a program does access the same data through pointers of a different type (for example, by a "pointer to int" and a "pointer to float"), you must not allow the compiler to assume ANSI C aliasing rules, because these rules can result in the generation of incorrect code.
Per the C++ language rules, the default is -ansi_alias.
-assume [no]pointers_to_globals
Controls whether the compiler can safely assume that global variables have not had their addresses taken in code that is not visible to the current compilation.The default is -assume pointers_to_globals, which directs the compiler to assume that global variables have had their addresses taken in separately compiled modules and that, in general, any pointer dereference could be accessing the same memory as any global variable. This is often a significant barrier to optimization.
While the -ansi_alias option allows some resolution based on data type, -assume pointers_to_globals provides significant additional resolution and improved optimization in many cases.
The -assume pointers_to_globals option tells the compiler that any global variable accessed through a pointer in the compilation must have had its address taken within that compilation. The compiler can see any code that takes the address of an extern variable. If it does not see the address of the variable being taken, the compiler can assume that no pointer points to the variable.
Note that -assume pointers_to_globals does not tell the compiler that the compilation never uses pointers to access global variables.
-assume [no]whole_program
Tells the compiler that except for "well-behaved library routines", the whole program consists only of the single object module being produced by this compilation. The optimizations enabled by -assume whole_program include all those enabled by -assume nopointer_to_globals and possibly other optimizations.The default is -assume nowhole_program.
You can define the DEC_CXX environment variable to change the "default" behavior of the cxx command. For example, to make ARM language mode the default using csh shell, define DEC_CXX as follows:
setenv DEC_CXX "-std arm" |
You can place a single vertical bar ("|") within the variable. All arguments preceding the bar are evaluated before any explicit command-line arguments; all arguments following the bar are evaluated afterwards. In the absence of a vertical bar, all arguments are evaluated before the explicit command-line arguments.
If -v is specified, the definition of environment variable is reported. For example, assuming the definition of DEC_CXX above, the cxx -v command results in the following:
% cxx -v $DEC_CXX contains: -std arm |
This release provides the following compiler version options:
-newcxx
Invokes the Version 6.0 compiler. This is the default.-oldcxx
Invokes a bug fix update to the Version 5.7 compiler.The -oldcxx option is provided for cases where the Version 6.0 compiler requires excessive source changes or for problems in using the V6.0 compiler. If extensive source changes are required to correct errors, try using the -std arm option (see Section 1.3.1). For excessive warnings, try the -msg_quiet option (see Section 1.3.2). If you want -oldcxx to be the default, define the DEC_CXX environment variable as follows:
setenv DEC_CXX "cxx -oldcxx"See Section 1.3.9.
Note that the optional -oldcxx subset must be installed before you can use the -oldcxx option. See the DIGITAL C++ Installation Guide for DIGITAL UNIX Systems .
This section provides details about differences between the current and previous compiler versions:
Users should be aware of the following language differences between the current and previous versions of the compiler:
bool, const_cast, explicit, export, false, mutable, dynamic_cast, reinterpret_cast, static_cast, true, typeid, typename, wchar_t |
typedef void (*PF)(); // Pointer to an extern "C++" function extern "C" typedef void (*PCF)(); // Pointer to an extern "C" function void f(PF); void f(PCF); |
#include <iostream.h> struct A { int a; }; struct D : public virtual A { A* toA(){ return (A*) this; } }; main () { D* d = NULL; A* ad = d->toA(); if (ad==NULL) cout << "ok"; // will seg fault } |
volatile int *vptr; int *ptr=vptr; |
Users should be aware of the following implementation differences between the current and previous versions of the compiler:
f(const int p1); f(int p1); |
f(i++, i++); |
Aspects of memory allocation and deallocation have changed. See -[no]stdnew and -[no]global_array_new in Section 1.3.4 for more
information.
1.3.11.4 Run-Time Library Differences
Code generated by the Version 6.0 compiler requires a newer version of the C++ run-time library (libcxx than is provided by DIGITAL UNIX Versions prior to 4.0D.
Using DIGITAL C++ on DIGITAL UNIX Version 4.0D or
Later
On DIGITAL UNIX Version 4.0D or later, the version of libcxx.so required for use with DIGITAL C++ Version 6.0 is installed by the operating system; no special actions are required.
Using DIGITAL C++ on DIGITAL UNIX Version 4.0C or Earlier to
Link and Run Programs
On versions prior to 4.0D, you must install the following subset from the DIGITAL C++ Version 6.0 kit before you can link or execute programs:
DIGITAL C++ Run-Time Library (libcxx) for DIGITAL UNIX V4.0C and earlier |
If you attempt to link code generated by DIGITAL C++ Version 6.0 before installing this subset, the link might fail because of unresolved symbols. For example, if you have not installed the libcxx subset and you attempt to link code using C++ exception handling, the link will fail as follows:
% cxx -o etest.out etest.cxx ld: Unresolved: __cxx_exception_caught __cxx_handler_exit(need, new, libcxxso) __cxx_v60_dispatch(need, new, libcxxso) |
This subset also must be installed on any system on which you want to execute code generated by DIGITAL C++ Version 6.0. If you attempt to execute a program before installing this subset, the execution will fail because of unresolved symbols; for example:
% etest.out etest.out: /sbin/loader: Error: unresolvable symbol in etest.out: __cxx_exception_caught etest.out: /sbin/loader: Error: unresolvable symbol in etest.out: __cxx_handler_exit__X4need3new8libcxxso etest.out: /sbin/loader: Error: unresolvable symbol in etest.out: __cxx_v60_dispatch__X4need3new8libcxxso etest.out: /sbin/loader: Fatal Error: this executable has unresolvable symbols |
For both cases, different unresolved symbols may appear depending on the particular language features used.
Note that you can install the libcxx subset without installing the base compiler subset.
Redistributing libcxx.so
If you distribute your software for use on pre-Version 4.0D systems on which DIGITAL C++ Version 6.0 might not be installed, you can redistribute libcxx.so under the conditions stated in the Software Product Description. The recommended mechanism for redistributing libcxx.so is for you to provide the .tar file /usr/lib/cmplrs/cxx/CXXREDIST600V01.tar. This tar file contains a setld kit that installs /usr/lib/cmplrs/cxx/libcxx.so. You should also provide the following instructions for installing libcxx.so from the tar file:
setld -i | grep CXX | grep installed |
/usr/sbin/setld -l CXXREDIST600.kit |
Implementation Notes
For DIGITAL UNIX Version 4.0D and later, /usr/shlib/libcxx.so (installed by the operating system) contains the support needed for DIGITAL C++ Version 6.0.
For DIGITAL UNIX versions prior to V4.0D, the libcxx subset and the restribution subset both
install /usr/lib/cmplrs/cxx/libcxx.so to
avoid overwriting the version of libcxx.so installed by the operating system
(/usr/shlib/libcxx.so). When linking, the
compiler passes -rpath /usr/lib/cmplrs/cxx
-L/usr/lib/cmplrs/cxx to ld.
This causes ld to search /usr/lib/cmplrs/cxx before searching the system
libraries, and the loader to search for libraries in that directory
when loading code for execution. If you specify -rpath explicity, you need to make sure to
specify /usr/lib/cmplrs/cxx in the path
string in addition to any other directories that you want searched.
1.3.12 Language Differences Between the Final Draft International Standard and DIGITAL C++
The following items, specified in the Final Draft International Standard (FDIS), are not supported in Version 6.0 but will be supported in a future version:
template <class T> void f(T *); int main() { int *p = 0; f<int>(p); // Not yet allowed } |
template <class T, template <class> class C> class Xrefd { // not yet allowed C<T> mems; C<T*> refs; }; |
The following general restrictions apply for Version 6.0:
< cxx: Warning: A non-default pointer size or member alignment is specified and the system header files are not protected. This may yield unpredictable results. The protect_headers_setup script can help. See the protect_headers_setup(8) man page for details. |
namespace_name::name |
//one.cxx namespace ns { int a; } void two(); main() { two(); } //two.cxx namespace ns { int a; } namespace ns { // extend the namespace float b; } void two() { } |
print "two.cxx"`ns::b #qualifying with name file two.cxx ; print ns::b #setting file scope |
vm: vm-mapentries=5000 |
# /sbin/sysconfigdb -f /tmp/xxx -m vm |
This section contains suggestions for improving build performance when
using DIGITAL C++ on your system.
1.5.1 Object File Compression
By default, DIGITAL C++ compresses object files. This reduces object
file size and can result in shortened link times, depending on
characteristics of the system and the application. For some large
applications, object file compression can significantly slow down the
compiler and the linker and can significantly increase the amount of
virtual memory required when linking. For some large applications, it
is advantageous to compile without object file compression. To do so,
specify the -nocompress option on the
cxx command.
1.5.2 Using Shared Libraries
Partitioning a large application into several shared libraries, which
are then linked into an executable, is a useful technique for reducing
link times during development. See Using DIGITAL C++ for DIGITAL UNIX Systems for details.
1.5.3 Using Precompiled Headers
Using precompiled headers can reduce compilation time in environments where
See Using DIGITAL C++ for DIGITAL UNIX Systems for details.
1.5.4 Using Special Template Options
To speed up build times for programs that make extensive use of templates, you can specify the -ttimestamp option.
See Using DIGITAL C++ for DIGITAL UNIX Systems for details.
1.6 Reducing Object File Size During Debugging
With DIGITAL C++ Version 5.6 and higher, the compiler reduces the amount of debugging information in object files when -g is specified. If the debugger describes a class as <opaque> or lacks debugging information, you may need to compile using the -gall option. See Section 1.6.1 for information on how to use the -gall option.
Before Version 5.6, debug information for classes and structs was generated whenever they were processed by the compiler. Thus, debug information for particular classes and structs defined in header files often appeared in multiple object files, which increased the overall size of objects and executables. To reduce debuggable executable size, DIGITAL C++ now attempts to generate debug information for a particular class or struct as few times as possible. Describing classes and structs this way has tremendous savings; reductions in executable sizes of up to 70% have been observed for some applications.
In most cases, the object file that contains the debug information for a particular class is linked into the executable and is available to the debugger. However, there are some situations where this might not be the case:
If ladebug describes a class or struct as <opaque>, you should compile the file in which the class or struct is described as <opaque> with the -gall option. Compiling a file with the -gall option generates debug information for all classes and structs that appear in that source file.
You can generate complete debugging information when compiling a particular file by specifying the -gall option on the command line. You can also define a pattern using the -gall_pattern option so that a file is compiled with complete debugging only if the file name matches the pattern. Specifying -gall_pattern lets you compile all files with the same command and still have particular files compiled with the -gall option to generate complete debugging information. You can specify a pattern in two ways:
The -gall_pattern option accepts a list of file names (with each file name separated by a comma or colon), filename patterns, or a combination of a file name list and filename patterns. See fnmatch(3) for valid filename patterns.
If you specify -gall, -g is assumed. The -gall_pattern option is ignored unless -g, -g2, or -g3 is also specified.
Example:
The following example shows how opaque_class is initially described as <opaque> by ladebug, and how this is remedied by compiling the file opaque_file.cxx with the -gall option:
Welcome to the Ladebug Debugger Version 4.0-44 ... object file name: opaque_file Reading symbolic information ...done (ladebug) # First, note the class is <opaque> (ladebug) whatis opaque_class class opaque_class <opaque> Information: An <opaque> type was presented during execution of the previous command. For complete type information on this symbol, recompilation of the program will be necessary. Consult the compiler man pages for details on producing full symbol table information using the -g (and -gall) for cxx) flags. (ladebug) # Next, find the offending file with ladebug's "file" command (ladebug) file opaque_file.cxx (ladebug) # Quit to recompile opaque_file.cxx with the -gall option (ladebug) quit |
Recompile the file opaque_file.cxx with the -gall option in one of the following ways:
cxx -g -gall -O0 opaque_file.cxx |
cxx -g -gall_pattern opaque_file.cxx -O0 opaque_file.cxx |
CXX = cxx CXXFLAGS = -g -gall_pattern opaque_file.cxx -O0 $(CXX) $(CXXFLAGS) opaque_file.cxx |
setenv CXX_GALL_PATTERN "opaque_file.cxx" cxx -g -O0 opaque_file.cxx |
Here are some alternate methods, showing the pattern capabilities of the -gall_pattern option:
cxx -g -gall_pattern opaque_file.cxx,another_file.cxx -O0 opaque_file.cxx |
setenv CXX_GALL_PATTERN "opaque*.cxx:another*.cxx" cxx -g -O0 opaque_file.cxx |
For best debugging and smallest objects and executables, we recommend that you use the -gall option selectively as follows:
This section describes the problems fixed, known problems, and
restrictions for the DIGITAL C++ Class Library. See Section 1.8 for
information on the C++ Standard Library. Please note that String
Package, which is part of the DIGITAL C++ Class Library, is
entirely different from the String class that is part of the
newly-implemented C++ Standard Library and known as the String
Library. Do not confuse these two contrasting implementations.
1.7.1 Restrictions
The following restrictions apply for Version 6.0:
#include <iostream.hxx> void main() { clog << "abc"; } |
cxx clog.cxx -lm -lcxx |
cxx clog.cxx -non_shared -lm -lcxx |
ld: /usr/lib/cmplrs/cxx/libcxx.a(iostream_globals.o): clog: multiply defined |
cxx clog.cxx -lcxx -lm |
This section describes the enhancements, problems fixed, known problems, and restrictions for the C++ Standard Library. See Section 1.7 for information on the DIGITAL C++ Class Library. Please note that the current version of DIGITAL C++ implements the new standard string class, known as the String Library. Do not confuse this with the String Package, which is part of the DIGITAL C++ Class Library implemented in earlier versions of DIGITAL C++.
Note that portions of the ANSI C++ Standard Library have been implemented in DIGITAL C++ using source licensed from and copyrighted by Rogue Wave Software, Inc. Information pertaining to the C++ Standard Library has been edited and incorporated into DIGITAL C++ documentation with permission of Rogue Wave Software, Inc. All rights reserved.
Portions copyright 1994-1997 Rogue Wave Software, Inc.
1.8.1 Enhancements and Changes in Version 6.0
The C++ Standard Library provided with this release defines a complete specification (with some differences) of the Final Draft International ANSI C++ Standard (FDIS). The standard library in this release includes for the first time the ANSI locale and iostream libraries. Reference pages describing the standard library are provided; you can type man cxxlib_intro to access them.
Tutorial programs illustrating functionality found in the standard C++ library including the locale, iostream, and STL classes shipped with this release can be found in:
/usr/examples/cxx/*.cxx |
You can compile and run these programs and use them as models for your own coding. The expected output for each program can be found in:
/usr/examples/res/*.res |
Version 6.0 introduces the following major enhancements and changes. For detailed information, on the DIGITAL C++ Standard Library, refer to Using DIGITAL C++ for DIGITAL UNIX Systems.
Additional changes include the following:
long long l; cout << l << endl; // compiles without error |
distance(first,last,d); // pre 6.0 the result was returned in d |
d = distance(first,last); // 6.0 |
This section describes problems when using the current release of the C++ Standard Library with the DIGITAL C++ compiler. Where appropriate, workarounds are suggested.
algorithm.cc | fstream.cc | locale.cc | streambuf.cc | vector.cc |
bitset.cc | ios.cc | locimpl.cc | string.cc | |
byname.cc | istream.cc | numbrw.cc | tree.cc | |
complex.cc | iterator.cc | ostream.cc | valarray.cc | |
deque.cc | list.cc | sstream.cc | valimp.cc |
#include <new.h> // override default operator new inline void* operator new(size_t s); // this will give an error |
inline void* operator new(size_t s) throw(bad_alloc); |
<stdcomp> <stl_macros> <stddefs> <compnent> <stdmutex> <stdexcept> <lochelp> <locimpl> <locimpl.cc> <valimp> <valimp.cc> <vendor> |
cxx: Warning: /usr/include/cxx/utility, line 131: type qualifier is meaningless on cast type detected during: instantiation of "std::pair<const int, char>::pair() ... : first(T1()), second(T2()) --------^ |
typedef multimap<int, char, less<int> > mmap; typedef pair<int, char> pair_type; pair_type p1 (3, 'c'); pair_type p2 (4, 'd'); ... pair_type array [] = {p1,p2,p3,p4,p5,p6}; mmap m (array, array + 6); |
-msg_disable cast_to_qualified_type |
input_iterator output_iterator forward_iterator bidirectional_iterator random_access_iterator |
// construct n elements and initialize with value explicit vector(size_type n, const T& value = T(), const Allocator&=Allocator()); // construct a vector using iterator ranges template<class InputIterator> vector (InputIterator first, InputIterator last, const Allocator&=Allocator()); |
vector<int> v2(5,0); |
vector(unsigned long, int) vs. vector(int, int) |
#include <vector> using namespace std; int main () { vector<int> v(5,0); //no ambiguity - corrected in library v.assign(5,3); //ambiguity not yet corrected return 0; } |
#include <vector> using namespace std; int main () { vector<int> v(5,0); v.assign((size_t)5,3); //workaround with cast to size_t return 0; } |
#include <iostream.h> struct B { operator bool() { return true; } }; struct W { operator wchar_t() { return L'0'; } }; int main() { B b; cout << b << endl; // V6.0 ambiguity error W w; cout << w << endl; // V6.0 ambiguity error return 0; } |
#include <iostream.h> #include <vector> int main () { vector<bool> vb; cout << vb[1] << endl; // V6.0 ambiguity error return 0; } |
int main() { B b; cout << (bool)b << endl; W w; cout << (wchar_t)w << endl; return 0; } int main () { vector<bool> vb; cout << (bool)vb[1] << endl; return 0; } |
#include <set> class myelement { public: myelement (int); }; set<myelement> S; int main () {return 0;} |
#include <set> class myelement { public: myelement () {} myelement (int); }; set<myelement> S; int main () {return 0;} |
Error: Can't find or exec: /usr/lib/cmplrs/cxx/cc : Arg list too long |
-use_ld_input |
#include <math.h> #include <exception> int main () { ::exception e; // exception from math.h std::exception e1; // Standard Library exception class return 0; } |
#include <iostream> #include <fstream> using namespace std; int main() { fstream fs ("t.in",ios_base::out); fs << "A"; return 0; } |
Ayz |
A |
#include <iostream> #include <fstream> int main() { fstream fs ("t.in",ios_base::in); return 0; } |
#include <new> ... // redefine global operator new, // entry point into C++ Class Library // based on compiling -nostdnew void *operator new(size_t size) { printf("in my global new\n"); ... } // entry point into C++ Standard Library // based on compiling -stdnew extern "C" void *__stdnw__XUl(size_t size) { return ::operator new(size); } |
Digital Equipment Corporation makes no representations that the use of its products in the manner described in this publication will not infringe on existing or future patent rights, nor do the descriptions contained in this publication imply the granting of licenses to make, use, or sell equipment or software in accordance with the description.
Possession, use, or copying of the software described in this publication is authorized only pursuant to a valid written license from Digital or an authorized sublicensor.
©Digital Equipment Corporation 1997. All Rights Reserved.
1.10 Trademarks
The following are trademarks of Digital Equipment Corporation: Alpha, Bookreader, DEC, DECnet, Ladebug, DECthreads, OpenVMS, VAX, VAX DOCUMENT, VMS, and the DIGITAL logo.
PostScript is a trademark of Adobe Systems Incorporated.
UNIX is a registered trademark in the United States and other countries licensed exclusively through X/Open Company Ltd.
Portions of the ANSI C++ Standard Library have been implemented using source licensed from and copyrighted by Rogue Wave Software, Inc. All rights reserved.
The software and information pertaining to such portions of the C++ Standard Library are proprietary to, and comprise valuable trade secrets of, Rogue Wave Software, Inc., which intends to preserve as trade secrets such software and information.
This software and information is furnished pursuant to a written license agreement and may be used, copied, transmitted, and stored only in accordance with the terms of such license and with the inclusion of the above copyright notice. This software and information or any other copies thereof may not be provided or otherwise made available to any other person.
Contents |