This manual instructs you in the use of the C++ 5.0 compiler, and provides detailed information on command-line compiler options.
This manual is intended for programmers with a working knowledge of C++ and some understanding of the Solaris(TM) operating environment and UNIX\256 commands.
This book contains the following chapters:
Chapter 1, "The C++ Compiler," gives an overview of the C++ compiler.
Chapter 2, "Using the C++ Compiler," provides instructions for invoking the compiler and generally discusses the compilation process.
Chapter 3, "C++ Compiler Options," explains the C++ compiler options in detail and provides task-oriented option groupings.
Chapter 4, "Using Templates," discusses use of templates, including template compilation, definition searching, and instance linkage.
Chapter 5, "Using Libraries," explains how to use the many C++ libraries.
Chapter 6, "Building Libraries," reviews the library-building process.
The Sun(TM) WorkShop(TM) C++ compiler documentation applies to the release of the C++ compiler on Solaris 2.5.1, 2.6, and Solaris 7 operating environments on:
The SPARC(TM) platform
The x86 platform, where x86 refers to the Intel implementation of one of the following: Intel 80386, Intel 80486, Pentium, or the equivalent
The latest operating environment release is Solaris 7, but code and path or package path names may use Solaris 2.7 or SunOS 5.7.
The term "x86" refers to the Intel 8086 family of microprocessor chips, including the Pentium, Pentium Pro, and Pentium II processors and compatible microprocessor chips made by AMD and Cyrix. In this document, the term "x86" refers to the overall platform architecture. Features described in this book that are particular to a specific platform are differentiated by the terms "SPARC" and "x86" in the text.
The following books are part of the C++ 5.0 documentation package.
C++ Programming Guide tells you how to use C++ 5.0 features to write more efficient programs. Some of the areas discussed include using templates, exception handling, casting, runtime type identification, and interfacing with FORTRAN 77.
C++ Library Reference describes the C++ libraries, including the C++ Standard Library, the Tools.h++ Class Library, the Sun WorkShop Memory Monitor, and the iostream and complex libraries.
C++ Migration Guide explains what you need to know when moving from 4.0, 4.0.1, 4.1, or 4.2 versions of the C++ compiler to the C++ 5.0 version.
Tools.h++ User's Guide discusses the use of C++ classes for enhancing the efficiency of your programs.
Tools.h++ Class Library Reference provides details on the Tools.h++ Class Library.
C++ Standard Library 2.0 User's Guide instructs you in the use of the C++ Standard Library, including locales and iostreams.
C++ Standard Library Class Reference provides more detailed information on the use of the C++ Standard Library.
Sun WorkShop Memory Monitor User's Guide describes how to use the Sun WorkShop Memory Monitor garbage collection and memory management tools.
The following books are part of the Sun Visual WorkShop C++ documentation package:
Sun WorkShop Quick Install provides installation instructions.
Sun WorkShop Installation and Licensing Reference provides supporting installation and licensing information.
Sun Visual WorkShop C++ Overview gives a high-level outline of the C++ package suite.
Using Sun WorkShop gives information on performing development operations through Sun WorkShop.
C User's Guide tells how to use the C compiler.
Numerical Computation Guide details floating-point computation numerical accuracy issues.
Debugging a Program With dbx provides information on using dbx commands to debug a program.
Analyzing Program Performance With Sun WorkShop describes the profiling tools; the LoopTool, LoopReport, and LockLint utilities; and use of the Sampling Analyzer to enhance program performance.
Sun WorkShop TeamWare User's Guide describes how to use the Sun WorkShop TeamWare code management tools.
Sun WorkShop Performance Library Reference Manual discusses the library of subroutines and functions to perform useful operations in computational linear algebra and Fourier transforms.
Sun WorkShop Visual User's Guide describes how to use Visual to create C++ and Java(TM) graphical user interfaces.
The following Solaris manuals provide additional useful information:
The Solaris Linker and Libraries Guide gives information on linking and libraries.
The Solaris Programming Utilities Guide provides information for developers about the special built-in programming tools available in the SunOS(TM) system.
The following is a partial list of available books on the C++ language.
Object-Oriented Analysis and Design with Applications, Second Edition, Grady Booch (Addison-Wesley, 1994).
Thinking in C++, Bruce Eckel (Prentice Hall, 1995).
The Annotated C++ Reference Manual, Margaret A. Ellis and Bjarne Stroustrup (Addison-Wesley, 1990).
Design Patterns: Elements of Reusable Object-Oriented Software, Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, (Addison-Wesley, 1995).
C++ Primer, Third Edition, Stanley B. Lippman and Josee Lajoie (Addison-Wesley, 1998).
Effective C++-50 Ways to Improve Your Programs and Designs, Second Edition, Scott Meyers (Addison-Wesley, 1998).
More Effective C++-35 Ways to Improve Your Programs and Designs, Scott Meyers (Addison-Wesley, 1996).
STL Tutorial and Reference Guide-Programming with the Standard Template Library, David R. Musser and Atul Saini (Addison-Wesley, 1996).
C++ for C Programmers, Ira Pohl (Benjamin/Cummings, 1989).
The C++ Programming Language, Third Edition, Bjarne Stroustrup (Addison-Wesley, 1997).
The SunDocsSM program provides more than 250 manuals from Sun Microsystems, Inc. If you live in the United States, Canada, Europe, or Japan, you can purchase documentation sets or individual manuals using this program.
For a list of documents and how to order them, see the catalog section of the SunExpress(TM) Internet site at http://www.sun.com/sunexpress.
Sun WorkShop documentation is available online from several sources:
The docs.sun.com Web site
AnswerBook2TM collections
HTML documents
Online help and release notes
The docs.sun.com Web site enables you to access Sun technical documentation online. You can browse the docs.sun.com archive or search for a specific book title or subject. The URL is http://docs.sun.com.
The Sun WorkShop documentation is also available using AnswerBook2 software. To access the AnswerBook2 collections, your system administrator must have installed the AnswerBook2 documents during the installation process (if the documents are not installed, see your system administrator or Chapter 3 of Sun WorkShop Quick Install for installation instructions). For information about accessing AnswerBook2 documents, see Chapter 6 of Sun WorkShop Quick Install, Solaris installation documentation, or your system administrator.
To access AnswerBook2 documents, Solaris 2.5.1 users must first download AnswerBook2 documentation server software from a Sun Web page. For more information, see Chapter 6 of Sun WorkShop Quick Install.
The following Sun Workshop documents are available online only in HTML format:
Tools.h++ Class Library Reference
Tools.h++ User's Guide
Numerical Computation Guide
Standard C++ Library User's Guide
Standard C++ Class Library Reference
Sun WorkShop Performance Library Reference Manual
Sun WorkShop Visual User's Guide
Sun WorkShop Memory Monitor User's Manual
To access these HTML documents:
Open the following file through your HTML browser:
install-directory/SUNWspro/DOC5.0/lib/locale/C/html/index.html
Replace install-directory with the name of the directory where your Sun WorkShop software is installed (the default is /opt).
The browser displays an index of the HTML documents for the Sun WorkShop products that are installed.
Open a document in the index by clicking the document's title.
This release of Sun WorkShop includes an online help system as well as online manuals. To find out more see:
Online Help. A help system containing extensive task-oriented, context-sensitive help. To access the help, choose Help Help Contents. Help menus are available in all Sun WorkShop windows.
Release Notes. The Release Notes contain general information about Sun WorkShop and specific information about software limitations and bugs. To access the Release Notes, choose Help Release Notes.
The docs.sun.com Web site enables you to access Sun technical documentation online. You can browse the docs.sun.com archive or search for a specific book title or subject. The URL is http://docs.sun.com/.
The Sun WorkShop documentation is also available using AnswerBook(TM) software. To access the AnswerBook collections, your system administrator must have installed the AnswerBook package during the installation process. For information on installing and accessing AnswerBook software see the Sun WorkShop installation documentation, the Solaris installation documentation, or your system administrator.
This release of Sun WorkShop includes an online help system as well as online manuals. To find out more, see:
Online Help. A help system containing extensive task-oriented, context-sensitive help. To access the help, choose Help Help Contents. Help menus are available in all Sun WorkShop windows.
Release Notes. The Release Notes contain general information about Sun WorkShop and specific information about software limitations and bugs. To access the Release Notes, choose Help Release Notes.
The following table describes the typographic changes used in this book.
Table P-1 Typographic Conventions
Typeface or Symbol |
Meaning |
Example |
---|---|---|
AaBbCc123 |
The names of commands, files, and directories; on-screen computer output. |
Edit your .login file. Use ls -a to list all files. machine_name% You have mail.
|
AaBbCc123 |
What you type, contrasted with on-screen computer output. |
machine_name% su Password: |
AaBbCc123 |
Command-line placeholder: replace with a real name or value. |
To delete a file, type rm filename. |
AaBbCc123 |
Book titles, new words or terms, or words to be emphasized. |
Read Chapter 6 in User's Guide. These are called class options. You must be root to do this. |
Compiler options and code samples may use the following conventions: |
||
[ ]
|
Square brackets contain arguments that are optional. |
-xO[n]
|
( ) |
Parentheses contain a set of choices for a required option. |
-d(y|n) |
|
|
The "pipe" or "bar" symbol separates arguments, only one of which may be used at one time. |
-d(y|n)
|
...
|
The ellipsis indicates omission in a series. |
-xinline=f1[,...fn]
|
%
|
The percent sign indicates the word has a special meaning. |
-ftrap=%all, no%division
|
<>
|
In ASCII files, such as the README file, angle brackets contain a variable that must be replaced by an appropriate value. |
-xtemp=<dir>
|
The following table shows the default system prompt and superuser prompt for the C shell, Bourne shell, and Korn shell.
Table P-2 System Prompts
Shell |
Prompt |
---|---|
C shell prompt |
machine_name% |
C shell superuser prompt |
machine_name# |
Bourne shell and Korn shell prompt |
$ |
Bourne shell and Korn shell superuser prompt |
# |