[ Pobierz całość w formacie PDF ]
.Obviously since Unix was written in C I also wanted a high degree of C compatibility.Very early, 1980 onwards, it was used by other people (helped by me) for simulations of variousnetwork protocols and traffic management algorithms.Where does the name C++ come from?As C with Classes (my ancestor to C++) became popular within Bell Labs, some people foundthat name too much of a mouthful and started to call it C.This meant that they needed toqualify what they meant when they wanted to refer to Dennis Ritchie s language, so they used Old C, Straight C, and such.Somebody found that disrespectful to Dennis (neither Dennisnor I felt that) and one day I received a request though Bell Labs management channels to finda better name.As a result, we referred to C++ as C84 for a while.That didn t do much good,so I asked around for suggestions and picked C++ from the resulting list.Everybody agreedthat semantically ++C would have been even better, but I thought that would create too manyproblems for non-geeks.Were there any particularly difficult or frustrating problems you had to overcomein the development of the language?Lots! For starters, what should be the fundamental design rules for the language? What shouldbe in the language and what should be left out? Most people demand a tiny language providingevery feature they have ever found useful in any language.Unfortunately, that s impossible.After a short period of relying on luck and good taste, I settled on a set of rules of thumbintended to ensure that programs in C++ could be simultaneously elegant (as in Simula67, thelanguage that introduced object-oriented programming) and efficient for systems programming(as in C).Obviously, not every program can be both and many are neither, but the intent was(and is) that a competent programmer should be able to express just about any idea directlyand have it executed with minimal overheads (zero overheads compared to a C version).Convincing the systems programming community of the value of type checking was surpris-ingly hard.The idea of checking function arguments against a function declaration was fiercelyresisted by many at least until C adopted the idea from C with Classes.These days, object-oriented programming is just about everywhere, so it is hard for peopleto believe that I basically failed to convince people about it s utility until I finally just put invirtual functions and demonstrated that they were fast enough for demanding uses.C++ svariant of OOP was (and is) basically that of Simula with some simplifications and speedups.C compatibility was (and is) a major source of both problems and strengths.By being Ccompatible, C++ programmers were guaranteed a completeness of features that is often missing21in first releases of new languages and direct (and efficient) access to a large amount of code notjust C code, but also Fortran code and more because the C calling conventions were simpleand similar to what other languages supported.After all, I used to say, reuse starts by usingsomething that already exists, rather than waiting for someone developing new componentsintended for reuse.On the other hand, C has many syntactic and semantic oddities and keepingin lockstep with C as it evolved has not been easy.What are the main differences between the original C with Classes and C++?Most of the differences were in the implementation technique.C with Classes was implementedby a preprocessor, whereas C++ requires a proper compiler (so I wrote one).It was easy totranscribe C with Classes programs into C++, but the languages were not 100% compatible.From a language point of view, the major improvement was the provision of virtual functions,which enabled classical object-oriented programming.Overloading (including operator over-loading) was also added, supported by better support for inlining.It may be worth noting thatthe key C++ features for general resource management, constructors and destructors, were inthe earliest version of C with Classes.On the other hand, templates (and exceptions) wereintroduced in a slightly later version of C++ (1989); before that, we primarily used macros toexpress generic programming ideas.Would you have done anything differently in the development of C++ if you hadthe chance?This common question is a bit unfair because of course I didn t have the benefits of almost 30years of experience with C++ then, and much of what I know now is the result of experimentationwith the earlier versions of C++
[ Pobierz całość w formacie PDF ]