C/C++ Programmer's Guide (G06.27+, H06.08+, J06.03+)

Table 17 VERSION2 Standard C++ Library Example Files (continued)
Description of ContentsExample File
Tutorial Example Source FileALG6C
Tutorial Example Source FileALG7C
Tutorial Example Source FileAUTTESTC
Tutorial Example Source FileCALCC
Tutorial Example Source FileCOMPLXC
Tutorial Example Source FileCONCORDC
Tutorial Example Source FileEXCEPTNC
Tutorial Example Source FileICECREAC
Tutorial Example Source FileRADIXC
Tutorial Example Source FileSIEVEC
Tutorial Example Source FileSPELLC
Tutorial Example Source FileTELEC
Tutorial Example Source FileWIDWORKC
Compiling and Linking in the OSS Environment
In addition to the C++ compiler pragmas recognized as command-line flags as described in
Chapter 13: Compiler Pragmas, the OSS c89 and c99 utilities have a -Wcplusplus flag that
affects both compilation and linking. This flag:
Defines the __CPLUSPLUS feature-test macro to modify C header files for C++.
Causes all specified files with names suffixed by .c to be compiled as C++ files.
If a linker is also involved or in other words if -c flag is not used, using the -Wcplusplus flag
causes the standard C++ libraries to be linked.
If the -Wcplusplus flag is not specified and none of the files operated upon by c89 or c99 has
a suffix of .C, .cpp, .cc, or .cxx, c89 or c99 compiles the source files only as C files; if the
-c flag is also omitted, c89 or c99 only links the C standard library.
Pragmas for the Standard C++ Library
You need to use the MAPINCLUDE and CPATHEQ pragmas to map UNIX or OSS pathnames to
Guardian file names. HP provides a CPATHEQ file for this purpose; the file is named SLMAP for
the Standard C++ Library. Like any CPATHEQ file, the SLMAP file maps OSS directory and file
names to the Guardian namespace ($volume.subvolume). Similarly, there is a TLHMAP file for
mapping names in Tools.h++ version 7.
The contents of a CPATHEQ file such as the
SLMAP file:
#ifndef __SLMAP
#define __SLMAP
#pragma mapinclude "rw/math.h" = "mathh"
#pragma mapinclude "rw/random.h" = "randomh"
#pragma mapinclude "rw/stddefs.h" = "stddefsh"
#pragma mapinclude "rw/stdgen.h" = "stdgenh"
#pragma mapinclude file "algorithm.cc" = "algoricc"
#pragma mapinclude file "bitset.cc" = "bitsetcc"
#pragma mapinclude file "complex.cc" = "complecc"
#pragma mapinclude file "deque.cc" = "dequecc"
#pragma mapinclude file "iterator.cc" = "iteratcc"
88 Using the Standard C++ Library