Compaq C++
Compaq C++
Using Compaq C++ for Tru64 UNIX
Appendix A
Class Library Restrictions
This appendix describes known problems and restrictions for the Class
Library. Please note that String Package, which is part of the
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.
The following restrictions apply for the C++ Class Library:
- Conflict with redefinition of clear()
If your program includes both <curses.h> and <iostream.hxx>, Compaq C++ might fail
to compile your program because clear()
is defined by both header files. In <curses.h>, clear() is defined as a macro whereas in <iostream.hxx> clear() is defined as a member function.
Workarounds:
If your program does not use either clear() or uses the <curses.h> clear(), include the <iostream.hxx> header first, followed by
<curses.h>.
If your program
uses the ios::clear() function, undefine
the clear() macro directly after the
#include <curses.h> statement.
- Because of a bug in the task package, if you are using that package
and you compiled your application with Compaq C++ Version
6.n, your application may encounter runtime errors such as
segmentation faults. To avoid these problems, recompile your
application specifying the -preempt_symbol option. For more information
about the -preempt_symbol option, see the
cxx(1) reference page.
- Use of clog() and the iostream
package's clog
A single application
is restricted from using both the math library function clog() and the iostream package's clog object. This restriction is necessary
because libm and libcxx each contain a definition for the global
symbol clog and these definitions are
incompatible.
For example, consider a program that makes use of the
iostream clog object:
#include <stdlib.h>
#include <iostream.hxx>
int main()
{
clog << "abc";
return EXIT_SUCCESS;
}
|
If you link with the math library first as:
Executing the program results in a segmentation fault. The compiler
links against shared object libraries by default. Identical symbols in
subsequent object libraries are resolved to the first definition by the
symbol preemption feature. So in this case use of clog from iostreams is resolved to the
definition in libm.
If you link -non_shared with the math library first as:
cxx clog.cxx -non_shared -lm -lcxx
|
The linker gives a multiply defined message similar to the
following:
ld:
/usr/lib/cmplrs/cxx/libcxx.a(iostream_globals.o): clog: multiply defined
|
In this case, if you link with the Class library first, the program
executes correctly. As described earlier, the compiler links against
shared object libraries by default. Identical symbols in subsequent
object libraries are resolved to the first definition by the symbol
preemption feature. So in this case use of clog from iostreams is resolved to the
definition in libcxx:
Therefore, applications that reference either of the clog symbols should not include both -lcxx and -lm on
their ld command line.
- Displacing global operator new in C++ Standard Library/Class
Library
If a C++ program defines a global operator new() which is
intended to displace the version used by the C++ Standard Library, it
must be compiled with the compiler command line switch -stdnew. If a C++ program defines a global
operator new() which is intended to displace the version used by the
C++ Class Library, it must be compiled with the compiler command line
switch -nostdnew.
- The Class Library does not include support for 128-bit long doubles.
privacy and legal statement