Programming Language - Mentor of your Computer

Page 72

C++

68

Etymology According to Stroustrup: "the name signifies the evolutionary nature of the changes from C".[9] During C++'s development period, the language had been referred to as "new C", then "C with Classes". The final name is credited to Rick Mascitti (mid-1983) and was first used in December 1983. When Mascitti was questioned informally in 1992 about the naming, he indicated that it was given in a tongue-in-cheek spirit. It stems from C's "++" operator (which increments the value of a variable) and a common naming convention of using "+" to indicate an enhanced computer program. There is no language called "C plus". ABCL/c+ was the name of an earlier, unrelated programming language.

Philosophy In The Design and Evolution of C++ (1994), Bjarne Stroustrup describes some rules that he used for the design of C++: • C++ is designed to be a statically typed, general-purpose language that is as efficient and portable as C • C++ is designed to directly and comprehensively support multiple programming styles (procedural programming, data abstraction, object-oriented programming, and generic programming) • C++ is designed to give the programmer choice, even if this makes it possible for the programmer to choose incorrectly • C++ is designed to be as compatible with C as possible, therefore providing a smooth transition from C • C++ avoids features that are platform specific or not general purpose • C++ does not incur overhead for features that are not used (the "zero-overhead principle") • C++ is designed to function without a sophisticated programming environment Stroustrup also mentions that C++ was always intended to make programming more fun and that many of the double meanings in the language are intentional. Inside the C++ Object Model (Lippman, 1996) describes how compilers may convert C++ program statements into an in-memory layout. Compiler authors are, however, free to implement the standard in their own manner.

Standard library The 1998 ANSI/ISO C++ standard consists of two parts: the core language and the C++ Standard Library; the latter includes most of the Standard Template Library (STL) and a slightly modified version of the C standard library. Many C++ libraries exist which are not part of the standard, and, using linkage specification, libraries can even be written in languages such as C, Fortran, Pascal, or BASIC. Which of these are supported is compiler dependent. The C++ standard library incorporates the C standard library with some small modifications to make it optimized with the C++ language. Another large part of the C++ library is based on the STL. This provides such useful tools as containers (for example vectors and lists), iterators to provide these containers with array-like access and algorithms to perform operations such as searching and sorting. Furthermore (multi)maps (associative arrays) and (multi)sets are provided, all of which export compatible interfaces. Therefore it is possible, using templates, to write generic algorithms that work with any container or on any sequence defined by iterators. As in C, the features of the library are accessed by using the #include directive to include a standard header. C++ provides 69 standard headers, of which 19 are deprecated. The STL was originally a third-party library from HP and later SGI, before its incorporation into the C++ standard. The standard does not refer to it as "STL", as it is merely a part of the standard library, but many people still use that term to distinguish it from the rest of the library (input/output streams, internationalization, diagnostics, the C library subset, etc.). Most C++ compilers provide an implementation of the C++ standard library, including the STL. Compiler-independent implementations of the STL, such as STLPort,[10] also exist. Other projects also produce


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.