Compaq_C++_Version_6.3A_______________________ Release Notes for Compaq Tru64 UNIX March, 2001 This document contains information about new and changed features in this version of Compaq C++ for Tru64 UNIX. Compaq Computer Corporation Houston, Texas __________________________________________________________ © 2001 Compaq Computer Corporation. COMPAQ, the Compaq logo, and Alpha, DEC, Ladebug, OpenVMS, and VMS are registered in the U.S. Patent and Trademark Office. Tru64 is a trademark of Compaq Information Technologies Group, L.P. in the United States and other countries. UNIX is a trademark of The Open Group in the United States and other countries. All other product names mentioned herein may be trademarks of their respective companies. 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-2001 Rogue Wave Software, Inc. Compaq shall not be liable for technical or editorial errors or omissions contained herein. The information in this document is provided as is without warranty of any kind and is subject to change without notice. The warranties for Compaq products are set forth in the express limited warranty statements accompanying such products. Nothing herein should be construed as constituting an additional warranty. Confidential computer software. Valid license from Compaq 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. PostScript is a trademark of Adobe Systems Incorporated. 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 are 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. This document was prepared using DECdocument, Version 3.3-1n. ________________________________________________________________ Contents 1 Introduction................................. 1 2 Important Compatibility Information.......... 1 2.1 Run-Time Library Differences............. 2 2.2 Compiler Differences..................... 2 2.3 Difference between Compaq C++ and the C++ International Standard................... 3 3 Release Notes for the C++ Compiler........... 3 3.1 Enhancements, Changes, and Problems Corrected in V6.3-007.................... 3 3.2 Enhancements, Changes, and Problems Corrected in V6.3-006.................... 4 3.3 Enhancements, Changes, and Problems Corrected in V6.3-005.................... 4 3.4 Enhancements, Changes, and Problems Corrected in V6.3-003.................... 4 3.5 Enhancements, Changes, and Problems Corrected in Version 6.3................. 4 3.6 Restrictions in Version 6.3.............. 9 3.7 Enhancements, Changes, and Problems Corrected in Version 6.2-040............. 11 3.8 Enhancements, Changes, and Problems Corrected in Version 6.2-037............. 12 3.9 Enhancements and Changes in Version 6.2...................................... 14 3.10 Problems Corrected in Version 6.2........ 15 3.11 Restrictions in Version 6.2.............. 18 3.12 Problems Corrected in Version 6.1-029.... 22 3.13 Problems Corrected in Version 6.1........ 23 3.14 Enhancements and Changes in Version 6.0...................................... 26 4 Release Notes for the C++ Standard Library... 27 iii 4.1 Enhancements, Changes, and Problems Corrected in Version 6.3................. 27 4.2 Restrictions in Version 6.3.............. 29 4.3 Enhancements, Changes, and Problems Corrected in Version 6.2-037............. 29 4.4 Enhancements and Changes in Version 6.2...................................... 30 4.5 Problems Corrected in Version 6.2........ 32 4.6 Restrictions in Version 6.2.............. 36 4.7 Enhancements and Changes in Version 6.1-029.................................. 44 4.8 Problems Corrected in Version 6.1-029.... 44 4.9 Enhancements and Changes in Version 6.1...................................... 46 4.10 Problems Corrected in Version 6.1........ 51 5 About This Product........................... 52 iv 1 Introduction This document contains the release notes for Compaq C++ Version 6.3 for Compaq Tru64 UNIX. This kit installs two compilers: o The cxx command invokes the Version 6.3A compiler. o The cxx -oldcxx command invokes the 5.7 compiler. The version is V5.7-002. This compiler will not be included in future kits. ________________________Note ________________________ The Version 5.7 compiler's lack of support for 128- bit long doubles can cause crashes on Compaq Tru64 UNIX Version 5.0 or later. _____________________________________________________ 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 Compaq C++ HTML documentation. To view this documentation, point your browser to /usr/share/doclib/cplusplus/index.htm. 2 Important Compatibility Information Compaq strives to maintain a high degree of compatibility between successive versions of the compiler and its run- time environment. Because, however, each new version includes enhancements and changes, you should be aware of the following whenever you upgrade: o Differences between Run-Time Library versions o Differences between compiler versions o Difference between Compaq C++ and the C++ International Standard The next sections discuss these differences. 1 2.1 Run-Time Library Differences Applications must use a version of the C++ Run-Time library (libcxx) that provides all the functions they require. If an application is linked shared, and the correct library version is not installed, "undefined symbol" error messages appear at run time. Changes in the Run-Time Library occurred in Versions 6.0, 6.2, and 6.3. Any code that references the C++ Standard Library (any of the STL containers or algorithms, standard iostreams or locales) must be recompiled and relinked. This restriction does not apply to code that references the pre-standard class library, because the stability of that library's interface guarantees link compatibility in future releases. For information about redistributing the C++ Run-Time Library, see Deploying Your Application in Using Compaq C++ for Tru64 UNIX and Linux Alpha. 2.2 Compiler Differences Starting with Version 6.0, the Compaq C++ compiler differs significantly from previous versions. There are several major differences that you should be aware of before using a Version 6.n compiler for the first time. These differences are summarized here. For more detailed information, see Porting to Compaq C++ in Using Compaq C++ for Tru64 UNIX and Linux Alpha. o Language differences The compiler implements most of the C++ International Standard, which differs significantly from the language specified in the ARM (The Annotated C++ Reference Manual, 1991, by Ellis and Stroustrup) with some ANSI C++ extensions. When switching from a Version 5.n compiler, you might need to modify your source files, especially if you use the default language mode. In addition, language changes can affect the run-time behavior of your programs. If you want to compile Version 5.n source code with minimal source changes, specify the -std arm option. See Porting to Compaq C++ in Using Compaq C++ for Tru64 UNIX and Linux Alpha. 2 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.n compiler, you can compile using the cxx -oldcxx command. If you discover a compatiblity problem that is not documented, please file a PTR or SPR. o Diagnostic differences The Version 6.n compiler does more error checking than Version 5.7 and generates more diagnostics. If you want the number of diagnostics issued by the Version 6.n compiler to be similar to Version 5.7, compile with the -msg_quiet option. For details, see Message Control Options in Using Compaq C++ for Tru64 UNIX and Linux Alpha. o Implementation differences The automatic template instantiation model has been redesigned for the current version. Although code compiled with Version 5.n and 6.n compilers can be combined, you must complete the Version 5.n instantiation process with a Version 5.n (or specify the -oldcxx option) before linking with code compiled with Version 6.n. See Using Templates in Using Compaq C++ for Tru64 UNIX and Linux Alpha. 2.3 Difference between Compaq C++ and the C++ International Standard The export keyword for templates (Standard §14, paragraph 6; Stroustrup §9.2.3) is not supported in Version 6.3 but will be supported in a future version: 3 Release Notes for the C++ Compiler The following sections describe enhancements, changes, problems corrected, and restrictions for the C++ compiler. 3.1 Enhancements, Changes, and Problems Corrected in V6.3-007 o The GEM backend was upgraded. o Documentation updated to reflect 6.3A release. 3 3.2 Enhancements, Changes, and Problems Corrected in V6.3-006 o Components of the "-oldcxx" compiler are now in the appropriate subset. o Fixed arch EV68 support. 3.3 Enhancements, Changes, and Problems Corrected in V6.3-005 o The compiler no longer generates an error when compiling pthreads.h with "-std strict_ansi." o The GEM backend was upgraded. 3.4 Enhancements, Changes, and Problems Corrected in V6.3-003 o The compiler no longer generates a compiler memory access violation for a local function declaration inside a member function with the same name as a virtual and a non-virtual function in the function's base class. 3.5 Enhancements, Changes, and Problems Corrected in Version 6.3 Enhancements, changes, and problems corrected are as follows: o This version of the C++ compiler implements C++ headers for C Library Facilities. The headers avoid pollution of the global namespace by defining all C names only in namespace std. (See Stroustrup, §9.2.2 and §16.1.2.) The headers are located in the directory /usr/include/cxx_cname. If you include a header and use the -pure_cname option, all C functions and types found in that header file are declared only in namespace std, as specifed by the C++ International Standard. 4 Specifying the -nopure_cname option causes headers to be handled as if the corresponding version had been included. That is, names are available both in namespace std and global scope. The default is -pure_cname when compiling with -std strict_ansi and -std strict_ansi_errors. The default is -nopure_cname when compiling with -std ansi, -std arm, -std gnu, -std ms, and -std cfront. The compiler search order for include files has been changed from /usr/include/cxx /usr/include to /usr/include/cxx /usr/include/cxx_cname /usr/include Including after including the corresponding header brings all names declared in that header into global namespace with "using std::name" declarations. New Header Files and protect_headers_setup The addition of headers adds several new files and the new subdirectory /usr/include/cxx_cname. If you are using protect_headers_setup on your system, you might need to rerun it after installing or upgrading to the Compaq C++ Version 6.3 compiler. For more information, see the protect_headers_setup(8) reference page or Protecting System Header Files in Using Compaq C++ for Tru64 UNIX and Linux Alpha. Backward Compatibility In -pure_cname mode, does not include . Therefore, printf() is not declared unless is included. For example, the vfwprintf function, declared in , requires that and be included: int vfwprintf(FILE *, const wchar_t *, va_list); 5 New overloaded function signatures have been added to several headers (see Standard §21.4, §25.4, and §26.5). These overloaded signatures have been made available when including the header in -pure_cname mode. If the __CNAME_OVERLOADS macro is defined, the new signatures are available in both - pure_cname and -nopure_cname modes. On some operating system platforms, defining the __CNAME_OVERLOADS macro in -nopure_cname mode in combination with other macros and options (for example, -ms, -D_XOPEN_SOURCE) can cause compile errors. cmath (Standard §26.5) now provides float and long double overloaded signatures for math functions in -pure_cname mode, or in -nopure_cname mode with the __CNAME_OVERLOADS macro defined. On some operating system platforms, defining the __CNAME_OVERLOADS macro in -nopure_cname mode in combination with other macros and options (for example, -ms, -D_XOPEN_SOURCE) can cause compile errors. These added signatures could cause type ambiguity problems or different runtime behaviour in existing code. Consider theses examples: o sin(1) is now ambiguous because overloads are provided for float, double, and long double. A user sees the following differences, because the argument of sin(1) is assumed to be of type int: cout << "sin(1) = " << sin(1) << endl; // generates an error cxx: Error: t.cxx, line 15: more than one instance of overloaded function "sin" matches the argument list: function "std::sin(long double)" function "std::sin(float)" function "std::sin(double) C" argument types are: (int) cout << "sin(1) = " << sin(1) << endl; -----------------------^ o The type of the argument to an overloaded math function determines the type of its return value and associated precision. Calls to math functions using float or long double arguments may return 6 less precise or more precise values than previously. Compare the following: o Previous compiler release: long double ldout = sin(1.0); ldout = 0.84147098480789650000 o Current compiler release: long double ldout = sin(1.0); // type int argument - ambiguous long double ldout = sin(1.0l); // type long double argument ldout = 0.84147098480789650000 long double ldout = sin(1.0f); // type float argument ldout = 0.84147095680236816000 Signatures have been added in cstring, cwchar, and cstdlib header files for the following functions: cstring: (Standard §21.4) strchr, strpbrk, strrchr, strstr, memchr cwchar: (Standard §21.4) wcschr,wcspbrk, wc- srchr,wcsstr, wmemchr cstdlib: (Standard §25.4) bsearch, qsort, (§26.5) abs, div The added signatures could cause problems in existing code. For example, because char* strchr(const char*, int) now has overloads const char* strchr(const char*, int) and char* strchr(char*, int), the following code does not work: #include void f(char*) {;} int main() { f(strchr("abc",1)); // strchr returns a const char* return 0; } o The -t option has two new variants, -ti (include C++ header files) and -tj (include cname header files). For a complete description of the -t option, see the cxx(1) reference page. 7 o In strict_ansi mode, the name of a class is now entered as a member of itself, as required by clause 9 (para 2) of the Standard; this behavior is implemented more or less as an implicitly declared member typedef and might cause some existing programs to fail. For example: namespace std { class iterator {}; } struct tree { struct iterator {}; struct nested : public std::iterator { // Compaq C++ 6.2 and below thinks this is tree::iterator // Compaq C++ ?? in strict_ansi mode thinks this is std::iterator nested(const iterator&); }; }; [6613] o The error "incompatible parameter", issued when there is a difference in sign between pointers, has been made discretionary. As a result you can now reduce/increase the severity of this message or enable/disable it using its error tag incompatibleprm or its error number. The same can also be done by enclosing the offending code in #pragma. For Example, the error message for the following program can now be controlled. void f(unsigned int *i) { } void main() { f((int *)0x05); } In addition, specifying -std gnu reduces the message severity to warning. 8 3.6 Restrictions in Version 6.3 The following restrictions apply for the current release: o In Version 5.n, if you allocate an array of objects of a class type with a constructor but without a destructor using new[n], you will be unable to deallocate this object using delete[] in a module compiled with Version 6.n because the hidden count was not stored during the allocation. [7232] o Because the task library is being retired, it is no longer a shared object. You must therefore specify - threads -lcmalib on the cxx command line in addition to -ltask for the link. [7976] o A template mangling problem can occur if you use class template partial specializations with non-type template arguments in the compiler's model arm mode. For example, the following program produces a compilation error: template struct C {}; template struct D {}; template struct D > { void foo(); }; template struct D > { void foo(); }; int main() { D< 1, 2, C<2, 1> > d; d.foo(); D< 2, 1, C<2, 1> > d2; d2.foo(); return 0; } 9 The problem occurs because the two instantiations of foo() are incorrectly mangled identically. As shown in the example, this happens when the template parameter list is instantiated with the same arguments in the same order, but the template argument list is actually different. If the calls to D<...>::foo() were made from two different source files, the compiler would not give an error; instead it would incorrectly call the same instantiation for both calls. This problem cannot be corrected without breaking link compatibility with objects produced from the previous releases. The name is mangled correctly in the compiler's model ansi mode. For more details on the model ansi compiler option, see the description of the -model [ansi | arm] option in the cxx.1 reference page. [8012] o A problem in libexc on Tru64 UNIX before Version 4.0E generates an error message when an exception is thrown from a constructor that will be called by a static initialization, as in the following example. The error message appears after the example. There is no workaround for the problem. #include #include #include void term_handler() { printf("in terminate handler\n"); abort(); } class C { public: C() { std::set_terminate(&term_handler); throw 5; } }; C c; 10 int main() { return 0; } The code generates the following error message: exception system: exiting dues to multiple internal errors: exception dispatch or unwind stuck in infinite loop exception dispatch or unwind stuck in infinite loop [CPP 5021] 3.7 Enhancements, Changes, and Problems Corrected in Version 6.2-040 Enhancements, changes, and problems corrected are as follows: o In certain cases, dynamic initialization of a static variable of aggregate type with an initializer list containing both constant and non-constant values did not occur correctly. Aggregate members initialized with constant values were initialized with 0, not with the constant values. Consider this example: const float x = 3; struct S { static long *_GetEntries() { static long _entries[] = { 2, (long)x, 8 }; return _entries; } } In this example _entries[0] and _entries[2] were not initialized correctly to 2 and 8, respectively. Instead, the fields were both were incorrectly initialized to 0. The compiler inserts code into _GetEntries to initialize _entries the first time _GetEntries is called. Because it failed to insert the initializing code correctly, the code that initialized members with contant values was not being executed. 11 3.8 Enhancements, Changes, and Problems Corrected in Version 6.2-037 Enhancements, changes, and problems corrected are as follows: o In certain cases, dynamic initialization of a static variable of aggregate type with an initializer list containing both constant and non-constant values did not occur correctly. Aggregate members initialized with constant values were initialized with 0, not with the constant values. Consider this example: const float x = 3; struct S { static long *_GetEntries() { static long _entries[] = { 2, (long)x, 8 }; return _entries; } } In this example _entries[0] and _entries[2] were not initialized correctly to 2 and 8, respectively. Instead, the fields were both were incorrectly initialized to 0. The compiler inserts code into _GetEntries to initialize _entries the first time _GetEntries is called. Because it failed to insert the initializing code correctly, the code that initialized members with contant values was not being executed. o When generating EV6 code, the peephole optimizer could display an assertion failure complaining that an operand is not fixed or not float. This has been corrected. [6787] o When generating EV6 code, the compiler produced a code pattern (specific to conversion between integer and floating types) that could produce incorrect results. This release corrects the problem. [6816] o If the exception handling mechanism calls the two- parameter delete operator to clean up an allocated object that had an exception in the constructor, the 12 mechanism now passes the correct size to the second (size) parameter. [6823] o When compiling with -std arm, C++ treated the types const char *&, and char *& as equivalent. Effects- compatible types did not recognize this behavior. A new ARM-compatible flag for types_are_compatible with effects_compatible_types is now set when in ARM mode. The new flag specifies that all type qualifiers are ignored when comparing the type compatiblity of two pointer or reference types. [6949] The ARM mode of the compiler allows a const char * reference to reference a char * object, as show in the following example: static char * f() { char *value = 0; const char * & d1 = value; // d1 can reference value d1 = "abc"; // changes value return value; // should return "abc", not 0 } In standard mode, however, this behavior is not allowed, and the compiler did not recognize that assignments to the reference change the value of the object referenced. In the example, because the compiler did not recognize that assignments to d1 would change value, it assumed that the assignment to d1 did not occur and that the correct return value fo the function f() was 0. This version of the compiler fixes the problem. o A change in the debugging symbol table produced by the C++ compiler causes all namespace members to be generated in the local symbol table of the file descriptor associated with the namespace, within the scope of the namespace. This change make it easier to debug namespaces. [LDB1569] 13 3.9 Enhancements and Changes in Version 6.2 Version 6.2 includes the following enhancements and changes: o Some functions needed for language compatibility run- time support have been moved from libcxxstd.a to the shared library libcxx.so. For details, see Deploying Your Application in Using Compaq C++ for Tru64 UNIX and Linux Alpha. o Many compiler and library problems have been corrected (see Section 3.10 and Section 4.5). o Many improvements have been made to cross-reference information generated by the compiler. o The compilation system and run-time library now call destructors that are defined in shared images which have been closed correctly using dlclose(), with the linker option -depth_ring_search. This feature requires that a new libcxx be installed on your system with Version 6.2. Otherwise, the compiler reports the undefined symbol __cxx_call_static_dtors. o The -gall option now outputs debugging information about unused variables, so that you can queries the debugger about them. For more information about this option, see Using the -gall and -gall_pattern Options in Using Compaq C++ for Tru64 UNIX and Linux Alpha. o Debugging support for constant variables is improved. Although the compiler does not generate debug information for constant externs (because you might not be able to link), it does generate debug information for all constant variables whose underlying type is int or float o Diagnostics from the driver during the link phase are now sent to stderr instead of to stdout. o Consumption of virtual memory is significantly reduced when computing the addresses of deeply nested virtual base classes. [6473] 14 o The compiler diagnoses more cases of unreachable code. If you receive warnings you believe to be inappropriate, please report them. [6534] 3.10 Problems Corrected in Version 6.2 This section summarizes compiler changes and the most important problems corrected in Version 6.2. o Specifying -noglobal_array_new no longer causes generation of rogue cleanup handlers. [6095] o Enum types larger than int are now supported when compiling with -std arm. [4499] o Specifying -v now displays command-line, driver- generated, and predefined macros on standard output. The listing file now contains correct list of command- line and predefined macros, taking into account macro undefines and redefines. [4723] [5609] o Within a template member function instantiation, the compiler now correctly calls a function with short pointer in -xtaso_short mode. The compiler no longer displays an error for the call. o Some compiler-generated wrapper functions with the __STF____default_version prefix were not resolved in template automatic instantiation mode. The problem is corrected. [6362] o Debugging support is now provided for anonymous union variables inside namespaces. In the following example, debuggers support referencing s.a and s.b: struct S { union { int a; int b; } } s; In the following example, the compiler generates two variables, x and y, which the debuggers can examine. 15 union { int x; char y[4]; }; The compiler no longer generates tag names for tagless structs and unions. o Under the following conditions, the compiler could generate code that returned the value of i before the store of the new value: 1. Take the address of a variable, using a type other than the variable's type, (p = (char *)&i). 2. Assign to the variable using a pointer addition expression, *(p + 0) = new_value. 3. Fetch the variable's value directly (return i). The problem can occur only if the store using the pointer addition expression appears within an if statement, as in the following code: int f(int flag) { int len = 1; if (flag) { char *ppp = (char *)&len; *(ppp + 0) = 2; }; return len; } The problem has been corrected. [6421] o Bad code is no longer generated for an array reference within a template instantiation. [6394] o The compiler no longer generates incorrect code for offsets to external arrays. [6386] o The routine for new[] now calls delete[] if an exception occurs during construction. [6243] o A compiler crash caused by a label statement in a switch statement has been corrected. [6614] 16 o Macro expansions are now output to the listing file when both -show expansion and -source_listing are specified. [6107] o When a local stack is used in constructors, the compiler displays the warning "Initialization of references requires temporaries of automatic storage duration". [4522] o Null characters in comments are now ignored in - std arm mode. The Version 6.0 compiler treated null characters in comments as errors. Outside of comments, null characters are now diagnosed as warnings in -std arm mode, and as errors otherwise. [3740] o The compiler has implemented the _poppar builtin function and added code to convert output type for _poppar, _popcnt, _leadz, and _trailz to match contents of the UNIX builtins.h file. See Built-In Functions in Using Compaq C++ for Tru64 UNIX and Linux Alpha. o A template class name can now be reused as a nontem- plate class in a private namespace without generating an error message. [6541] o A Version 6.0 bug caused the the compiler to emit a union layout incompatible with earlier versions if the union contained bitfield of size 8, 16, 24 . . . up to the size of the type for the bitfield. For example: typedef struct size4 { union { unsigned ttn :8; struct { unsigned incr :3; unsigned rep :5; } v1; } u; } size4; The size of size4 is 4 bytes for Version 5.7, and was incorrectly set to 1 since Version 6.0. This bug is fixed in Version 6.2. If you have such a bitfield in your code, you must recompile. [6567] 17 o If -nocleanup is specified, the compiler does not reference the destructors or delete operators used for cleanup code that is not generated. The -noexceptions option now implies -nocleanup. [6216] o -std arm mode, the compiler no longer generates code to the left side of the -> and . operators if the right hand operand is a static member. [4469] o For compatibility with Version 5.6, the ec_inaccessible_ base_class error on function return expressions in -std arm mode is now disabled. [3744] o The compiler now warns about differences in meaningless qualifiers. o The driver now terminates if the compilation results in a fatal error or ctrl-c. o In -std arm mode, the compiler no longer checks for suitable copy constructors of classes with volatile qualifiers. [6087] o To maintain compatibility with arm, cfront, and ms modes, null preservation code is enabled for cases where a pointer should not be null. [4695] o The compiler now checks for comparison of two incompatible enums. The compiler reports this condition with a new informational message ec_incompatible_enum_ comparison. [6172] 3.11 Restrictions in Version 6.2 This release is not totally compatible with previous versions; source changes might be required. The following general restrictions apply for the current release: o The C++ International Standard permits overriding a virtual member function based only on a derived class return type. The current release does not support this capability. o Intrinsic bcopy generates warning 18 Starting with C++ Version 6.2, the bcopy function has been made intrinsic to improve performance. On Compaq Tru64 UNIX Version 4.n systems, this change can cause the compiler to issue the following warning message: cxx: Warning: /usr/include/strings.h, line 83: Expected type "void (const void *, void *, unsigned long) C" is incompatible with declared type "void (const char *, char *, int) C", function will not be made intrinsic extern void bcopy __((const char *, char *, int)); ------------^ Compaq Tru64 UNIX Version 4.n systems provide two function prototypes for bcopy, one that conforms to the standard, and another, the system default, for compatibility with previous operating system versions. The compiler issues the warning when it encounters the nonstandard version. For details, see the bcopy(1) reference page. To suppress the message, you can do one of the following: o Use an ANSI-standard copy function such as memcpy o Enable the standard function by defining -D_XOPEN_SOURCE_EXTENDED -D_OSF_SOURCE before including the header file o Compile with the -std strict_ansi option o Use #pragma function(bcopy) Because the next major operating system release implements a change in the UNIX98 standards and provides only the standard definition, the first or second method is recommended. The third and fourth methods prevent the function from being made intrinsic, resulting in degraded performance. o Some features implemented in Version 5.7 are not supported by the current compiler. See Porting to Compaq C++ in Using Compaq C++ for Tru64 UNIX and Linux Alpha. o Some objects might have their exception unwinding information set to a negative index in the cleanup table, resulting in a core dump at runtime if an exception is raised. [7091] 19 o The UNIX utility nm does not always work on Compaq Tru64 UNIX Version 4.n systems with object files generated by the current compiler. The symptom is a seg fault when nm attempts to dump its list. An alternative to nm might be the odump utility. For example, the command odump -tv foo.o lists all the symbols in the archive. See the odump reference page for more details on the odump utility. Another possible workaround is to compile your object file with -g (debugging), then recompile it without -g. That procedure might avoid triggering the nm bug. If you want to obtain a version of nm that corrects this problem, these are the patch kit identifiers: _______________________________________________________ OPERATING_SYSTEM_VERSION__PATCH_ID_____________________ v40 OSF400-438 v40a OSF405-438 v40b OSF410-438 v40c OSF415-438 v40d______________________OSF420-42____________________ o If you use a non-default pointer size or member alignment and header files are not protected, the following warning is issued: < 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) reference page for details. The protect_headers_setup(8) reference page page is planned for a future release of Compaq Tru64 UNIX. For now, see Protecting System Header Files in Using Compaq C++ for Tru64 UNIX and Linux Alpha. o Restricted address space size for precompiled headers in some versions of Compaq C++. Some versions of Compaq C++ might restrict the size of the address space available for use by precompiled headers. If the compiler terminates with a message about mapped memory, this may be the problem. 20 To increase the address space available for precompiled headers you need to increase the mapentries limit. Follow these steps to change the mapentries limit: 1. Become the root user. 2. Create a new file named /tmp/xxx and insert the following lines: vm: vm-mapentries=5000 3. Execute the sysconfigdb command as follows: # /sbin/sysconfigdb -f /tmp/xxx -m vm 4. Reboot the system. This procedure increases the mapentries limit from the default 200 to 5000. Increasing the limit by that amount has no adverse effect on the system. o When using PCH, the line number associated with an inline function is the line at which the PCH stop is encountered. o Certain utilities, such as GNU Make, do not recognize compressed object files, which the compiler creates by default. If you encounter problems, you can specify the -nocompress command-line option. o Instantiating function templates with array types can result in different external name encoding than with C++ Version 5.n. To avoid link errors, recompile the template definition with the current version of the compiler. o Linker -no_archive does not work with Compaq C++ The switch does not work because the Standard Library, libcxxstd.a, is supplied only in archive form. Specifying -no_archive causes the cxx drive to issue the following messages: ld (prelink): Can't locate file for: -lcxxstd ld: Can't locate file for: -lcxxstd 21 o Class and Standard Libraries generate Third Degree messages. Appendix C in Using Compaq C++ for Tru64 UNIX and Linux Alpha describes these messages. 3.12 Problems Corrected in Version 6.1-029 This section summarizes compiler changes, enhancements, and the most important problems corrected in Version 6.1- 029. o The optimization phase of the compiler has been changed to disable a specific optimization that caused ATOM based tools to behave unpredictably. This optimization may be restored once these tools have been enhanced to expect this optimization. o New warning messages indicate when assigning from a larger to a smaller data type might cause a truncation. These messages facilitate porting from 32-bit to 64-bit platforms. [3971] o A workaround has been implemented to prevent the linker from erroneously declaring too many GOTs during the prelink phase. [6027] [43-4-305] o Templates made friend are now instantiated with external linkage when -timplicit_local is specified. [6056] o Access checking for pointer to members in ARM mode has been relaxed to be more compatible with Version 5.n. [6088] o Calling operator(new) on an array of objects allocates extra header information to describe the array so that operator delete can call destructors on the elements. In this release, the header has been made compatible with object code generated with version 5.n releases. [6151] o During the prelink phase, the driver no longer splits linker output lines at 8000 characters. [6166] o The driver no longer suppresses error messages during the prelink phase. As a result, messages might apprear multiple times. This new behavior helps prevent silent or confusing failures. [6168] 22 o A problem unwinding from multiple exceptions has been corrected. [6185] o A compiler fatal error using volatile structures has been corrected. [6186] o The cxx driver no longer runs post-link phases that are unnecessary to determine required templates. [6191] o A problem with interaction between -vptr_size_short and -xtaso_short has been corrected. [6195] o If a local static object is referenced by more than one template, the compilation no longer results in an unresolved symbol for the __fini routine. The routines to call the destructors for static objects, which are prefixed with __fini, are now allocated properly with automatic instantiation mode. [6278] 3.13 Problems Corrected in Version 6.1 This section summarizes compiler changes, enhancements, and the most important problems corrected in Version 6.1. o The Version 6.0 compiler incorrectly mangled the name of a class virtual function table when that class was nested within another class or namespace. If object modules compiled with Version 5.n and Version 6.0 were linked together, the compiler might display the following message: ld: Unresolved: std::__vtbl_3std9type_info This problem has been corrected. Any code generated with Version 6.0 that demonstrates this problem should be recompiled with the current compiler. [5144] o The compiler used to mark all member functions of the class that had not already been specialized as needing to be instantiated when processing a #pragma define_template class . But the compiler did not instantiate the functions until processing the end of the scope. If a specialization occurred after the #pragma but before the compiler tried to instantiate it, the compiler found that the member function had 23 already been specialized and reported the following error: "function" cannot be instantiated -- it has been explicitly specialized This error is reduced to a warning and is issued only once per instantiation. The warning can be suppressed by using the command-line switch -msg_disable 490. See Compaq C++ Implementation in Using Compaq C++ for Tru64 UNIX and Linux Alpha. [43-4-137] o The compiler no longer generates incorrect code when dereferencing an element of an array of pointers. [5236] o A problem creating shareable libraries has been corrected by allocating static local const variables initialized with pointers to .rdata instead of to .rconst. [43-4-166] o To facilitate setting default compiler flags, you can now create an optional configuration file named comp.config or an environment variable named DEC_CXX. - The comp.config file allows system administrators to establish a set of compilation flags that are applied to compilations on a system-wide basis. The compiler flags in comp.config must be specified on a single line, and the comp.config file should be stored in the compiler target directory, /usr/lib/cmplrs/cxx. - The DEC_CXX environment variable allows users to establish a set of compilation flags that are applied to subsequent compilation on a per user basis. The DEC_CXX environment variable can contain two distinct sets of compilation flags separated by a single vertical bar ( | ). The flags before the vertical bar are known as prologue flags and the flags after the bar are know as epilogue flags. The DEC_CXX environment variable can begin or end with a vertical bar, or have no vertical bar at all. If no vertical bar is present, the flags are treated as prologue flags by default. Any vertical 24 bar found after the first vertical bar is treated as whitespace and a warning is issued. During a compilation, compiler flags are processed in the following order: 1. comp.config flags 2. DEC_CXX prologue flags 3. command line flags 4. DEC_CXX epilogue flags If -v is specified on the command line, the contents of DEC_CXX and comp.config, if present, are displayed. [4488] o By default, C files are compiled with -std. Users can now override the default by specifying -std0/-std1. [4392] o The compiler no longer mishandles "?" operations on a boolean type in constructs like that in the following example. [43-4-135] bool f(int i) { return (i<5 ? false : true ); } o Parallel compiles now work correctly because the com- piler no longer deletes an empty template repository. [5544] o The current version does not support the -show statistics option implemented in Version 5.7. The following are now supported: -nocpp -show expansion -xref -xref_stdout listing of predefined macros #pragma message 25 3.14 Enhancements and Changes in Version 6.0 This section briefly summarizes changes and enhancements made in Version 6.0. For information about compatibility issues that you might encounter using Version 6.2 if you have used Version 5.n in the past, refer to Porting to Compaq C++ in Using Compaq C++ for Tru64 UNIX and Linux Alpha. o Support for the C++ International Standard (with some differences, as described in Section 2.3), including the C++ Standard Library. See Section 4 for information about and changes to the Standard Library. o Language mode options For compatibility with previous versions, the compiler supports an ARM language mode and provides both -std ansi and -std arm language mode options, as well as options to support other C++ dialects. For details, see Porting to Compaq C++ in Using Compaq C++ for Tru64 UNIX and Linux Alpha. o Improved automatic instantiation of templates, including fewer restrictions. In particular, Compaq C++ no longer requires that template declarations and definitions appear in header files. For details, see Using Templates in Using Compaq C++ for Tru64 UNIX and Linux Alpha. o Support for precompiled headers to decrease compilation times. For complete information, refer to Precompiled Headers in Using Compaq C++ for Tru64 UNIX and Linux Alpha. o Performance optimization options To improve performance, the compiler provides the following options: o -[no]ansi_alias o -assume [no]pointers_to_globals o -assume [no]whole_program For details, see the cxx(1) reference page. o Run-Time type identification 26 The 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. For details, see Run-Time Type Identification in Using Compaq C++ for Tru64 UNIX and Linux Alpha. o Changes to behavior of the -gall option. See Using the -gall and -gall_pattern Options in Using Compaq C++ for Tru64 UNIX and Linux Alpha. 4 Release Notes for the C++ Standard Library The following sections describe enhancements, changes, problems corrected, and restrictions for the C++ Standard Library. For information about the Compaq C++ Class Library, see Appendix A in Using Compaq C++ for Tru64 UNIX and Linux Alpha. The current version of Compaq C++ implements the new Standard Library string class, known as the String Library. Do not confuse this class with the String Package, which is part of the DEC C++ Class Library implemented in earlier versions of Compaq C++. Portions of the ANSI C++ Standard Library have been implemented in Compaq 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 Compaq C++ documentation with permission of Rogue Wave Software, Inc. All rights reserved. Portions copyright 1994-1999 Rogue Wave Software, Inc. 4.1 Enhancements, Changes, and Problems Corrected in Version 6.3 Version 6.3 includes the following enhancements: o The tree data structure, which sets and maps usage, has been refined to decrease the amount of space allocated for small element size containers. [10.1475] 27 o To ensure thread safety, the basic_string reference count used to be protected by a mutex, which called thread locking and unlocking routines. Performance of this class in multithreaded applications has been improved by changing the implementation to use instead atomic builtins (see Appendix B in Using Compaq C++ for Tru64 UNIX and Linux Alpha). [10.1138] Version 6.3 corrects the following problems: o The Standard Library vector class now allocates space correctly for elements greater than 1024 bytes; runtime core dumps caused by incorrect allocation in previous versions no longer occur. [10.1459] o The iostreams and locales are now multi-thread safe. [10.1429] o Compiling a program in -std strict_ansi mode using the basic_fstream class no longer causes run-time seg faults or core dumps. [10.1357] o The basic_string::find_first_not_of(charT, size_type) function now works correctly if the string contained embedded nulls. [10.1316] o The Version 6.2 string extraction operator no longer removes the extra space at the end of the string, as in the following example ifstream inFile("input.dat"); // input.dat contains "abc de" inFile >> word; // read "abc" inFile.get(ch1); // ch1 should be space, was 'd' [10.1300] o Two of the basic_string::compare() member functions no longer throw an exception if the length of the second string is longer than the length of the current string. They no do so only if the position the user specifies within the second string is greater than the length of the second string. [10.1298] o The prototype for the set_new_handler() is now included in the header file when you specify -nostdnew on the command line. 28 o The basic_string::resize() member function now works correctly. If two strings point at the same underlying char* and the resize() function is called on one of them, you can change the underlying string for one of the strings without affecting the value of the other. o You can now call the algorithm stable_sort() more than once with the same container without causing a seg fault. 4.2 Restrictions in Version 6.3 Restrictions are as follows: o When using the Standard Library iostreams for interactive input to cin from a terminal, a user may have to type more than one Ctrl D to indicate end-of- file. [10.1413] o Currently you might encounter compilation errors if you try to use a user-defined allocator and pointer class with the STL containers. This problem will be fixed in a future release. [10.1430] 4.3 Enhancements, Changes, and Problems Corrected in Version 6.2-037 Enhancements, changes, and problems corrected are as follows: o Fix for unexpected null cleanup block error When an exception was raised and caught in the catch clause at runtime, some loops with a try-catch block would generate an internal error about an unexpected null cleanup block. This error was caused by the runtime environment and has been corrected. o Fix for raw_storage_iterator assignment operator In versions 6.2 and earlier, a problem in the assignment operator for the class raw_storage_iterator could cause a run-time seg fault if, for example, you called the algorithm stable_sort() more than once with the same container. The problem has been corrected. [10.1284] o Fix for basic_string::compare() member functions 29 In version 6.2, two of the basic_string::compare() member functions were throwing an exception if the length of the second string was longer than the length of the current string. This has been fixed so that they throw an exception only if the position the user specifies within the second string is greater than the length of the second string. [10.1287] o Fix for basic_string::resize() A problem in the basic_string::resize() member function in Version 6.2 has been corrected. The incorrect behavior was that if two strings pointed at the same underlying char*, and the resize() function was called on one of them, and if you then changed the underlying value for one string, the value for the other string would also be changed. [10.1287] o Fix to string assignment operator when assigning string with embedded nulls A problem in the basic_string assignment operator prevented strings containing embedded nulls from being copied correctly. The problem has been corrected. [10.1238] o Fix for missing set_new_handler() prototype when specifying -nostdnew The prototype for the set_new_handler() function was missing from the header file if you specified -nostdnew on the command line. The problem has been corrected. 4.4 Enhancements and Changes in Version 6.2 The following enhancements and changes are included in Version 6.2: o Cleaner header file inclusion policy This new version of the Standard Library is much cleaner in its inclusion of unnecessary headers. For example, the header file no longer includes . and no longer include . Programs that used to count on these inclusions might break. You can correct them by 30 explicitly including any header files you use in your own sources. o New interface to get_temporary_buffer and use_facet Because the Version 6.2 C++ compiler now supports explicit template function arguments, it also supports the standard interface to the get_temporary_buffer() function. The following example shows how code must change: Change this: get_temporary_buffer(len,(T*)0); // two arguments to this: get_temporary_buffer(len); // one argument where "T" is the value type of the container. The standard interface to the locale class use_facet() function is also now supported. The following example shows how code must change: Change this: use_facet(loc,(ctype*)0); to this: // use_facet only takes one argument use_facet >(loc); o Many common iostream and locale instantiations (for example, those based on the char type) have been put into the Standard Library to improve compile-time performance. If you want to instantiate them yourself and use your own instantiations (perhaps to have a debugging version), follow these steps: 1. Compile with the macro __FORCE_INSTANTIATIONS defined (-D__FORCE_INSTANTIATIONS). 2. Link with the option -nopreinst. The linker then finds the instantiations in your repository before it finds those in the Standard Library. 31 4.5 Problems Corrected in Version 6.2 The following problems are corrected in Version 6.2: o money_get/money_put locale facets now conform to C++ International Standard The money_get and money_put locale facets have been corrected to match the standard. In the previous version, for example, money_get appeared as: template > class money_get; They now correctly match the standard, where the interface appears as: template > class money_get; Note that the second template argument "Intl" has been removed. The member functions get() and put() now accept Intl as an argument. o ios_base::openmode flags set to conform to Standard The standard file stream classes have been corrected to conform to the Standard with regard to setting the ios_base::openmode flags. In the previous release, it was possible to create a file for reading and writing with this code: #define __USE_STD_IOSTREAM #include #include int main() { fstream fs("foo.out", ios_base::in | ios_base::out); fs << "abc" << endl; return EXIT_SUCCESS; } 32 In the current release, this code works only if the file already exists. If the file does not exist, you need to also specify ios_base::trunc; that is, you must change the first line in main() to: fstream fs("foo.out", ios_base::in | ios_base::out | ios_base::trunc); This conforms to table 92 in the Standard, which specifies the "C" equivalent of the File open modes. o Correction to list::sort(Compare) A bug in the list::sort(Compare comp) member function is corrected. Previously, if users supplied their own Comparison function object for the element of the list, the compiler issued a message stating that it required an operator< defined for the element type. This no longer occurs. o reverse_iterator now matches the Standard reverse_iterator has been changed to match the standard. It now takes only one template argument of type iterator instead of five. Users must change existing code to remove the additional unnecessary arguments. o bitset constructors no longer accept a const char o A bitset can no longer be constructed with a const char* argument. For example, the following no longer compiles: bitset<32> b("111111111"); The constructor that takes a string is a templatized constructor, and thus can perform type deductions only on exact matches, not conversions (for example, const char* to string). To make the code in the previous example compile with the current version, the argument must be explicitly cast to a string, as follows: bitset<32> b( string("111111111")); o assign(size_t) removed from vector, deque, list 33 Previous releases of the Standard Library contained a member function called assign() inside the vector, deque, and list classes. This function accepted only a size_t argument. This has been removed, because it is not in the Standard. You must add an extra argument indicating the value you want assigned. For example, you change calls like the following: v.assign(5); // where v is a vector to: v.assign(5, int()); o allocator<>::deallocate(pointer) removed The member function allocator<>::deallocate(pointer) has been removed. The Standard requires two arguments for this member function. The second argument should be of size_type and have the same value as the first argument passed to allocator<>::allocate(). o basic_ios now initializes skipws|dec To conform to the Standard, the following basic_ ios constructor constructs a basic_ios object and initializes the format control bits to skipws | dec: explicit basic_ios(basic_streambuf*sb) Previously ,this constructor also initialized the bit indicating that output is right justified. Because the constructor is called while constructing any of the IOStream objects cout, clog, cerr, wcout, wclog, or wcerr, the difference is apparent if you examine the format control bits set after initializing one of these objects. Consider the following program: 34 #include #include using namespace std; int main() { cout << cout.flags() << endl; cout << clog.flags() << endl; cout << cerr.flags() << endl; cout << wcout.flags() << endl; cout << wclog.flags() << endl; cout << wcerr.flags() << endl; return EXIT_SUCCESS; } The output now indicates that only the skipws and dec format control bits are initialized. Previously it would have indicated that the right bit was also set. o Some iterator classes removed The following classes no longer exist in the Standard and have been removed from library headers. reverse_bidirectional_iterator random_access_iterator bidirectional_iterator forward_iterator output_iterator input_iterator Use instead the template class iterator with the template argument category to indicate which type of iterator you are constructing. o The default allocator argument changed for basic_string The default allocator argument for the class basic_ string has been changed from allocator to allocator. Any STL container constructed with an allocator template argument no longer compiles, because the specialization of allocator does not contain all the necessary typedefs. o strstream now deletes underlying strstreambuf 35 A problem has been corrected in the Standard Library strstream classes that prevented underlying strstream- buf (and thus the string) from being deleted when the strstream object was destroyed. The standard states that they should be deleted if strmode & allocated is true and strmode & frozen is not true. For example: #define __USE_STD_IOSTREAM #include void func() { ostrstream myostr; myostr << "abc"; } If you called func() the string "abc" was never deleted when the myostr stream was destroyed. This problem has been corrected. Note that the Class Library strstream classes have always deleted the underlying string. o sync_with_stdio() function is static In previous versions, the function sync_with_stdio() was incorrectly declared as a member function of ios_ base. The function is now correctly defined as a static member function; it is no longer necessary to call it with the "->" or or "." notation. 4.6 Restrictions in Version 6.2 This section describes problems you might encounter when using the current release of the C++ Standard Library with the Compaq C++ compiler. Where appropriate, workarounds are suggested. o Do Not Use Standard Library template Definition File Names The Standard Library supplies the following template definition files in /usr/include/cxx: algorithm.cfstream.cc streambuf.cvector.cc time.cc bitset.cc ios.cc locimpl.cc string.cc ctype.cc 36 istream.cc numbrw.cc tree.cc collate.cc messages.cc complex.cc iterator.ccostream.cc valarray.ccmoney.cc deque.cc list.cc sstream.cc valimp.cc numeral.cc rwlocale.cc If you use the same prefix name for any of your local files and have the directory that contains them in your include search path before /usr/include/cxx, the automatic instantiation mechanism picks up your local copy and does not correctly find the library files. (See Using Compaq C++ for Tru64 UNIX and Linux Alpha for more information about how the prelinker finds template definition files.) Do not use any of these names as source file names for your application. o Redeclaration of Standard Library Functions Many of the prototypes in the Standard Library have been changed to conform to the C++ International standard by the addition of exception specifications. This means that if you have redeclared the declarations in your own code, you need to add the correct exception specification in order to match what's declared in the header. For example: #include // override default operator new // this gives an error inline void* operator new(size_t s); To prevent this, you'd need to change your new() declaration to: inline void* operator new(size_t s) throw(std::bad_alloc); o Files/Macros for Internal Use Only Compaq C++ Version 6.1 ships the following non-Standard headers which are for internal use only. Their contents are subject to change and can not be relied upon. 37