The C++ Compiler |
1 |
![]() |
Operating Environments
For an explanation of the specific operating environments supported in this release, refer to the README file. You can view this file by typing the command
Standards Conformance
The compiler implements the C++ language as described in the C++ Annotated Reference Manual (ARM). It also conforms to selected extensions of the January 1996 C++ Draft Working Paper (ISO).
Organization of the Compiler
The C++ compiler package consists of a front end, optimizer, code generator, assembler, template pre-linker, and link editor. The CC command invokes each of these components automatically unless you use command-line options to specify otherwise. Figure 1-1 shows the C++ compilation system
The C++ compiler package also includes:
C++ is designed as a superset of the C programming language. While retaining the efficient low-level programming, C++ adds:
Rather than having the C++ compiler do these automatic conversions, you can explicitly convert between types, just as you can in C.
A related area involves overloaded function names. In C++, you can give any number of functions the same name. The compiler decides which function should be called by checking the types of the parameters to the function call. This action may lead to ambiguous situations. If the resolution is not clear at compile time, the compiler issues an "ambiguity" error.
carrot1 + carrot2 |
has a value determined by your definition of + in the case of carrots. This definition does not override the original definition of +; as with overloaded function names, the compiler determines from context what definition of + it should use. Operators with extra definitions like this are called overloaded operators.
Object-Oriented Features
A program is object-oriented when it is designed with classes, and the classes are organized so that common features are embodied in base classes, sometimes called parent classes. The feature that makes this possible is inheritance. A class in C++ can inherit features from one base class or from several. A class that has a base class is said to be derived from the base class. Native Language Support
This release of C++ supports the development of applications in languages other than English, including most European languages and Japanese. As a result, you can easily switch your application from one native language to another. This feature is known as internationalization.
You can change your application from one native language to another by setting the locale. For information on this and other native language support features, see the operating system documentation.
C++ does have some important differences from C; an ordinary C program may not be accepted by the C++ compiler without some modifications. Chapter 7, "Moving From C to C++," discusses what you must know to move from programming in C to programming in C++.
Even though the differences between C and C++ are most evident in the way you can design interfaces between program modules, C++ retains all of C's facilities for designing such interfaces. You can, for example, link C++ modules to C modules, so you can use C libraries with C++ programs.