Evolving a language in and for the real world: C++ 1991-2006 Bjarne Stroustrup Texas A&M University www.research.att.com/~bs Abstract Obviously, the C++ community spent the most time and This paper outlines the history of the C++ programming lan- money on the first of those items. The ISO C++ standards guage from the early days of its ISO standardization (1991), committee tends to focus on the second with some concern through the 1998 ISO standard, to the later stages of the for the third. My main effort was on the third and the fourth. C++0x revision of that standard (2006). The emphasis is on The ISO committee is the focus for people who aim to the ideals, constraints, programming techniques, and people improve the C++ language and standard library. Through that shaped the language, rather than the minutiae of lan- such change they (we) hope to improve the state of the guage features. Among the major themes are the emergence art in real-world C++ programming. The work of the C++ of generic programming and the STL (the C++ standard li- standards committee is the primary focus of the evolution of brary’s algorithms and containers). Specific topics include C++ and of this paper. separate compilation of templates, exception handling, and Thinking of C++ as a platform for applications, many support for embedded systems programming. During most have wondered why — after its initial success — C++ didn’t of the period covered here, C++ was a mature language with shed its C heritage to “move up the food chain” and be- millions of users. Consequently, this paper discusses various come a “truly object-oriented” applications programming uses of C++ and the technical and commercial pressures that language with a “complete” standard library. Any tendencies provided the background for its continuing evolution. in that direction were squelched by a dedication to systems programming, C compatibility, and compatibility with early Categories and Subject Descriptors K.2 [History of Com- versions of C++ in most of the community associated with puting]: systems the standards committee. Also, there were never sufficient General Terms Design, Programming Language, History resources for massive projects in that community. Another important factor was the vigorous commercial opportunism Keywords C++, language use, evolution, libraries, stan- by the major software and hardware vendors who each saw dardization, ISO, STL, multi-paradigm programming support for application building as their opportunity to dis- tinguish themselves from their competition and to lock in 1. Introduction their users. Minor players saw things in much the same light In October 1991, the estimated number of C++ users was as they aimed to grow and prosper. However, there was no 400,000 [121]. The corresponding number in October 2004 lack of support for the committee’s activities within its cho- was 3,270,000 [61]. Somewhere in the early ’90s C++ left its sen domain. Vendors rely on C++ for their systems and for initial decade of exponential growth and settled into a decade highly demanding applications. Therefore, they have pro- of steady growth. The key efforts over that time were to vided steady and most valuable support for the standards ef- fort in the form of hosting and — more importantly — of 1. use the language (obviously) key technical people attending. 2. provide better compilers, tools, and libraries For good and bad, ISO C++ [66] remains a general- 3. keep the language from fragmenting into dialects purpose programming language with a bias towards systems programming that 4. keep the language and its community from stagnating • is a better C • supports data abstraction • supports object-oriented programming • supports generic programming An explanation of the first three items from a historical [Copyright notice will appear here once ’preprint’ option is removed.] perspective can be found in [120, 121]; the explanation of Evolving C++ 1991-2006 1 2007/5/25 “supports generic programming” is a major theme of this 2. Background: C++ 1979-1991 paper. Bringing aspects of generic programming into the The early history of C++ (up until 1991) is covered by my mainstream is most likely C++’s greatest contribution to the HOPL-II paper [120]. The standard reference for the first 15 software development community during this period. years of C++ is my book The Design and Evolution of C++, The paper is organized in loose chronological order: usually referred to as D&E [121]. It tells the story from the §1 Introduction pre-history of C++ until 1994. However, to set the scene for the next years of C++, here is a brief summary of C++’s early §2 Background: C++ 1979-1991 — early history, design history. criteria, language features. C++ was designed to provide Simula’s facilities for pro- §3 The C++ world in 1991 — the C++ standards process, gram organization together with C’s efficiency and flexibility chronology. for systems programming. It was intended to deliver that to §4 Standard library facilities 1991-1998 — the C++ stan- real projects within half a year of the idea. It succeeded. dard library with a heavy emphasis on its most impor- At the time, I realized neither the modesty nor the pre- tant and innovative component: the STL (containers, al- posterousness of that goal. The goal was modest in that it gorithms, and iterators). did not involve innovation, and preposterous in both its time scale and its Draconian demands on efficiency and flexibil- §5 Language features 1991-1998 — focusing on separate ity. While a modest amount of innovation did emerge over compilation of templates, exception safety, run-time type the early years, efficiency and flexibility have been main- information and namespaces. tained without compromise. While the goals for C++ have §6 Standards maintenance 1997-2003 — for stability, no been refined, elaborated, and made more explicit over the additions were made to the C++ standard. However, the years, C++ as used today directly reflects its original aims. committee wasn’t idle. Starting in 1979, while in the Computer Science Research §7 C++ in real-world use — application areas; applications Center of Bell Labs, I first designed a dialect of C called “C programming vs. systems programming; programming with Classes”. The work and experience with C with Classes styles; libraries, Application Binary Interfaces (ABIs), from 1979 to 1983 determined the shape of C++. In turn, C and environments; tools and research; Java, C#, and C; with Classes was based on my experiences using BCPL and dialects. Simula as part of my PhD studies (in distributed systems) in the University of Cambridge, England. For challenging §8 C++0x — aims, constraints, language features, and li- systems programming tasks I felt the need for a “tool” with brary facilities. the following properties: §9 Retrospective — influences and impact; beyond C++. • A good tool would have Simula’s support for program The emphasis is on the early and later years: The early years organization – that is, classes, some form of class hi- shaped current C++ (C++98). The later ones reflect the re- erarchies, some form of support for concurrency, and sponse to experience with C++98 as represented by C++0x. compile-time checking of a type system based on classes. It is impossible to discuss how to express ideas in code with- This I saw as support for the process of inventing pro- out code examples. Consequently, code examples are used to grams; that is, as support for design rather than just sup- illustrate key ideas, techniques, and language facilities. The port for implementation. examples are explained to make them accessible to non-C++ • programmers. However, the focus of the presentation is the A good tool would produce programs that ran as fast as people, ideas, ideals, techniques, and constraints that shape BCPL programs and share BCPL’s ability to combine C++ rather than on language-technical details. For a descrip- separately compiled units into a program. A simple link- tion of what ISO C++ is today, see [66, 126]. The emphasis age convention is essential for combining units written is on straightforward questions: What happened? When did in languages such as C, Algol68, Fortran, BCPL, assem- it happen? Who were there? What were their reasons? What bler, etc., into a single program and thus not to suffer the were the implications of what was done (or not done)? handicap of inherent limitations in a single language. C++ is a living language. The main aim of this paper • A good tool should allow highly portable implementa- is to describe its evolution. However, it is also a language tions. My experience was that the “good” implementa- with a great emphasis on backwards compatibility. The code tion I needed would typically not be available until “next that I describe in this paper still compiles and runs today. year” and only on a machine I couldn’t afford. This im- Consequently, I tend to use the present tense to describe it. plied that a tool must have multiple sources of implemen- Given the emphasis on compatibility, the code will probably tations (no monopoly would be sufficiently responsive to also run as described 15 years from now. Thus, my use of users of “unusual” machines and to poor graduate stu- the present tense emphasizes an important point about the dents), that there should be no complicated run-time sup- evolution of C++. port system to port, and that there should be only very Evolving C++ 1991-2006 2 2007/5/25 limited integration between the tool and its host operat- These criteria are explored in detail in Chapter 4 of D&E ing system. [121]. C++ as defined at the time of release 2.0 in 1989 strictly fulfilled these criteria; the fundamental tensions in During my early years at Bell Labs, these ideals grew into a the effort to design templates and exception-handling mech- set of “rules of thumb” for the design of C++.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages59 Page
-
File Size-