.

Thursday, April 4, 2019

The C Programming Language And Its History

The C Programming Language And Its HistoryIntroductionIn this Assignment, I shall be going through the stages and milest champions, which lead to the schooling of two successful scheduleming vocabularys, C++ and coffee. The schedule language C influenced bulkyly C++, and therefore I mat up it was necessary to delve late in this computer programing language as well. This assignment to a fault accommodates the decisions taken by their salwaysal(prenominal) creators and the abstract thought behind them.The C Programming LanguageBetween 1969 and 1973, the programming language C was under reading at ships bell Labs, by Dennis Ritchie. 1 During the resembling period, the operating trunk UNIX was under rebelment as well.1 In this section, I make most of my references to texts create verbally by Dennis Ritchie himself in the book History of Programming Languages.2 prehistoric cultureBefore C, during the late 60s, Bell Labs were passing through difficult times, mainly ref erable to the concomitant that the development of the Multics project was halted because the beneficial use of the GE-645 Multics employ would non be available on time and would be too costly.4 However, during and after the disposal of the cable car, an informal group, lead by good deal Thompson, began to research and develop new(prenominal) alternatives.4Ken Thompson aimed in constructing a comfortable add environment by using either resources available to him.4 His design involved implementing some(prenominal) similar ideas of Multics, much(prenominal) as an explicit nonion of a process as a locus of ascendence, a tree- coordinated file arranging of rules, a command interpreter as a user-level program, simple representation of text files, and generalized access to dodges.4 However, Ken Thompson in any case excluded other trustworthy aspects, including unified access to memory and to files.4 Furtherto a greater extent, instead of using PL/I which was the implem entation language of Multics, Thompson and his team use another programming language knget as BCPL.4 Just like PL/I, BCPL was alike a high-altitude language a great advantage which Thompson did not want to let go due to its uncloudedness and simplicity, unlike collection language.4The B Programming LanguageIn 1968, Ken Thompson was faced with a trouble with the PDP-7, a machine for which he had no compatible software available.4 Ken Thompson then created his own PDP-7 assembler, just now it was in 1969, that Doug Mcllroy created the first high-level language for the system.4 This language was an adaptation of the programming language know as TMG, which was created for the PDP-7 by R. M. McClure.4 Dennis Ritchie describes TMG as a language for writing compilers (to a greater extent generally, TransMoGrifiers) in a top-down, recursive-descent style that combines context-free syntax bill with procedural elements.4 TMG had been used to create the compiler of PLI for Multics.4 Ken Thompson then mat it was necessary for UNIX to have its own system programming language.4 After a reluctant causal agency to use FORTRAN, Thompson after designed a new-fangled programming language created B.4 The B programming language was developed mainly based on BCPL.4 Moreover, Dennis Ritchie describes B as BCPL squeezed into 8K bytes of memory and filtered through Thompsons brain.4 He then mentions that most probably, its name came closely by representing a contraction of BCPL.4 However, he might have chosen it as a lettering to his wife Bonnie.4Development was first completed by creating a TMG version of B, where Thompson then rewrote B in itself.6 Dennis Ritchie recalls that during this stage of development, Ken Thompson found the memory limitation to be a great challenge, as distributively language conferition inflated the compiler to barely fit.6 However, each re-write, due to the beneficial feature, reduce its size.6 Dennis Ritchie continues by mentioning an exam ple.6 He stated that, originally coming from ALGOL 60, B generalized assignment operators such that x =+ y was used to add x to y.6 The operator was then corrected to spell x += y back in 1976.6 Thompson was more innovative as he created new operators such as ++ and to increment and decrement.6 The position of these operators, written as postfix or prefix, would determine whether the change in respect would occur before or after noting the value of the operand.6Instead of producing machine enter, the PDP-7s B compiler generated wander code, in which the compilers output was make up of a sequence of addresses of code fragments that perform the wide-eyed operations.6 In the case for B, these operations worked on a straightforward stack.6However, due to the fact the PDP-7 machine was too small and slow, not much was written using B, except for B itself.6 It altogether served them for observational use. Re-writing UNIX on this machine prove to be too much of an expensive step. 6 Furthermore, Dennis Ritchie reports that at a stage, Ken Thompson expressed the address space crunch by offering a virtual B which made it possible for the interpreted program to take up more than 8k bytes.6 This was dvirtuoso by paging the code and entropy within the interpreter.6 However, it was then concluded that it would not be feasible enough and would case in being too slow for the common utilities.6 Despite all this, some utilities were until now written in B, such as an early version of the variable precision calculator cognize as dc.6Around this time, Dennis Ritchie excessively recalls working on an ambitious project, which mainly involved creating a genuine cross-compiler loose translating B to GE-635 machine instruction instead of thread code.6 Dennis Ritchie then comments that this task was only possible due to the workingity and ease of the B language.6The Unix project had proven itself so well, that they managed to get a PDP-11 at Bell Labs.6 By using the the threaded technique in order to run programs written in B on this machine, it was only necessary to write the code fragments for the operators, and a simple assembler in which the latter, Dennis Ritchie created himself.6 The first elicit program to be tested on the PDP-11, before any operating system software, was dc.6 Furthermore, around the same time, Ken Thompson managed to record the UNIX kernel, along with some simple commands written in PDP-11 assembly language.6 subsequently(prenominal) in his publisher, Dennis Ritchie mentions that apart from Bs advantage regarding its simplicity, it also had its problems mainly related to the PDP-11.7 He states that the machines, on which Bell Labs ab initio used BCPL and also B, were word-addressed.7 Furthermore, he continues by stating that these languages only handled one single data grammatical casecast, known as the cell, which would simply be equated with the hardware machine word.7 However, with the introduction of the PDP-11, a multiform of inadequacies of Bs semantic model were clearly visible, one of which was that its character-handling mechanisms tracking back to few changes from BCPL, were incompetent.7 For instance, Dennis Ritchie mentions that using program library procedures to spread packed strings into individual cells and then repack, or to access and re repoint individual characters did facial expression strange and at times even silly, on a machine based on bytes.7Despite that the first model of the PDP-11 was not capable of calculating floating-point arithmetic, the producer did affirm that this feature would be available shortly.7 By defining picky operators, floating-point operators were added to BCPL in their Multics and GCOS compilers.7 However, these operators were only possible on sure machines where a single word was large enough to contain a floating-point number and therefore could not be used on the 16-it PDP-11.7 some other inadequacy was that B and BCPL suffered from overh ead due to arrows.7 This was because the languages basis, by defining a pointer as an index in an regalia of words, restricted pointers to be represented as word indices.7 For each pointer reference, it generated a run-time scale conversion from the pointer to the corresponding byte address think by the hardware.7 out-of-pocket to all of these reasons, Dennis Ritchie realised that it was necessary to develop a typing scheme to be able to handle characters and byte addressing, and also be prepared to work with the coming floating-point hardware.7 At first, persona guard and interface checking was not considered to be vital and therefore were introduced at a later date.7 besides the issues with the B language, B compilers threaded-code technique made programs run slower than the same programs written in assembly language.7NB and CIn 1971, Dennis Ritchie started to expand the B language and called the slightly extended language NB, for new B.7 Dennis Ritchie also states that sinc e NB was used for a very short period, no documentation was done.8 He continues by mentioning that he added a character type and also developed its compiler to produce PDP-11 machine code instructions.8 Therefore, the compiler was capable of converting programs fast and small enough to contest with assembly language.8 All in all, NB offered the simple types int and char, arrays of them, and also pointers to them.8 The semantics of arrays found in B and BCPL stayed the same.8 Furthermore, inside procedures, the language interpreted pointers and array variables to be identical.8 Ritchie explains that a pointer declaration created a cell differing from an array declaration only in that the programmer was expected to assign a referent, instead of letting the compiler allocate the space and set the cell.8 The set that were held in cells, linked by array and pointer name calling, were bytes of machine addresses relating to their respective memory location.8 This was beneficial, as an in studyion through a pointer required no run-time overhead to form the pointer from a word to byte offset.8 However, the machine code for array deputizescripting and pointer arithmetic was dependant on the actual type of the array or pointer.8 Dennis Ritchie states that although these semantics made it very easy to transition from B, problems eventually began cropping up mainly when he tried to extend the type notation.8 He continues by explaining his difficulty in implementing structured (record) types.8 At first, it seemed structures should link correspondingly onto memory in the machine.8 However, the major issue was that for a structure containing an array, there was no ideal location to shop the pointer containing the base of the array, or a practical expressive style to signise it. 8The goal of Dennis Ritchie was that a structure would not just characterise an abstract prey but also describe a collection of bits that might be read from a directory.8 He describes the soluti on in achieving this goal as the crucial jump in the evolutionary chain amid type-less BCPL and typed C.8 Rather then having a materialization of the pointer located in memory, the pointer would be created only when the array name is refereed to in an expression.8 Moreover, values of type array, once mentioned in an expression, would change its values to pointers to direct to the objects making up the array.8 Despite the fact that the semantics of this new language had shiftily changed, most code written in B could still be used. Furthermore, this language also differed from its predecessors as it offered a statewide type structure and expression in the syntax of declaration.8After creating the type system, the associated syntax, and the compiler, Dennis Ritchie believed that this language deserved its own name, as when compared to NB, they were very distinctive.8 Therefore, he called the programming Language C, loss open the move whether the name represented a progression thro ugh the alphabet or through the letters in BCPL.8UNIX benefited greatly due to C. It made improving and maintaining UNIX very easy for any programmer who had an understanding of C. 1 Furthermore, it also made UNIX easily portable for newly developed calculating machines. 1 This is mainly because it was unnecessary to convert the operating system to assemble language manually, but only required a C assembly compiler for that limited machine. 1 This compiler translates the code into machine code that the device understands. 1 C has gained a huge amount of success over the years and is still presently used in development. It is mainly known for its fast speed. 1The C++ Programming LanguageThe book History of Programming Languages also contains a paper written by Bjarne Stroustrup, the creator of C++.9 In this paper, he narrates the history of the C++ programming language, focusing more on the ideas, limitation and people that shaped the language.9PrehistoryMore or less, Stroustrup be gins his paper by stating that C++ was based on an earlier version of a programming language known as C with Classes.10 However, before going into further detail, he begins discussing the prehistory of all this.10 At Cambridge University, whilst working on his Ph.D that dealt with the athletic field of different methods regarding the organization of software for a distributed system, Stroustrup focused on maturation software out of well-delimited modules and also created experimental simulator tool in order to simulate software running on a distributed system.10 This first version of the simulator was developed in Simula and ran on the Universitys IBM 360/165 mainframe.10It was very beneficial for Bjarne Stroustrup to use Simula, stating that the features of Simula were closely ideal for the purpose and I was specificly impressed by the way the concepts of the language helped me think nigh the problems in my act.10 Particularly, the behaviour of sectionalizationes allowed Str oustrup to link directly the application of his ideas to the language constructs easily, specially due to the fact that come apartes in Simula are able to behave as co-routines.10 He states that the use of class hierarchies enabled him to declare variants of application level concepts.10 He continues by explaining further, through an example, that different types could be described as classes deriving from other classes.10 The following are his exact words For example, different types of computers could be expressed as classes derived from class computer and different types of intermodule communication mechanisms could be expressed as classes derived from class IPC.10Other benefits of Simula were its type scheme and the energy to detect type errors through its compiler.10 The detection of a type error was either caused by some silly mistake, or due to some conceptual flaw in the design, in which two cases, especially the latter, helped Stroustrup greatly.10 He had not experience d such beneficial use with other more primitive loaded type systems.10 Furthermore, referring to his simulator, when the program increased in size, due to Simulas class, co-routine and precise type checking mechanisms, flaws and errors would not grow alongside.10 On the other hand, the implementation of Simula did not scale in the same way and nearly resulted in creating a disastrous program.10 Stroustrup concluded that Simula was ideal for writing small programs but suffered inherently for larger ones due to its silly run-time performance characteristics.10Today, Simula implementations have improved greatly, but at that time, in order to avoid terminating the project, Stroustrup rewrote the simulator in BCPL.10 He found programming in BCPL a very horrible experience, mainly due to its lack of type checking and run-time help.10 However, once the simulator was developed, the program ran competitively fast.10Once he graduated from Cambridge, Bjarne Stroustrup promised himself that h e would never attempt to clear a problem with those impractical tools as he had suffered sequence designing and implementing the simulator.10 However he did restrict what is a suitable tool for writing system programs, which was highly significant when he was developing C++. 10In Stroustrups eyes, a suitable tool involved the following characteristics.10 Firstly, it would have Simulas strengthener for program constitution and thus include classes, the ability to form class hierarchies, concurrency mechanisms, and a good type-checking scheme relating to classes.10 Secondly, it must also be capable of producing programs possessing similar speed as to BCPL programs, and also allow the combination of independently compiled units into a program.10 Lastly, it must allow the ability to create highly portable implementations.10C with ClassesThe undertaking, which eventually lead to developing C++, began in 1979, when Bjarne Stroustrup tried to understand the UNIX kernel, in order to l ine up out the limit that could be distributed over a network of computer via a topical anaesthetic area network (LAN).11 This work took place in the Computer Science Research Center of Bell Laboratories.11 With little time, Stroustrup faced two sub-problems, namely, how to read the network traffic that would result from the kernel distribution and how to modularize the kernel.11 They both required a way to describe the model structure of a complicated system and the communication trends of the modules, issues extremely similar to the innovation read that Stroustrup was eager to never have to face again without the suitable tools.11 Therefore, by referring to the criteria he had stated upon leaving Cambridge, Bjarne Stroustrup began to develop his own suitable tool.11 By October of 1979, he had a preprocessor called Cpre. 11Cpre was able to add Simula-like classes to C, and in March of 1980 this processor had been upgraded to actually support one real project and several experi ments.11 Later that year, between April and October, Stroustrup mentions that he let go of the ideal of thinking about a tool but earlier began thinking about a language, to develop what is known as C with Classes.11 However, ab initio, he did not consider C with Classes to be an independent language but just an expansion to C for expressing modularity and concurrency.11 C with classes did not support primitives for expression.11 Instead it included a mix of inheritance and offered a way to mold class member functions with special meanings understood by the preprocessor, which was used to develop the library that handled the required styles of concurrency. Stroustrup emphasises on the word styles and that it is written in plural.11 He found it vital that numerous notations of concurrency are able to be expressed in the language.11 Backed by colleagues, other C++ users and the C++ standards committee, to this day he still believes that this was the right decision.11 He then contin ues on this topic by stating that there in no one dominant model for concurrency support, and making use of a library or a special purpose extension for support on a particular form of concurrency would not limit others in using different forms.11 Therefore, the language provided general mechanisms for organising programs rather than support for specific application areas.11It was not only in this instance that Bjarne Stroustrup did not force programmers to use a particular style.11 C is capable of cipher numerous low-level operations, such as bit manipulation and choosing between different sizes of integers.11 Furthermore, although C++ consistently eliminates the need to use such low-level operators due to safety, they are still available for programmers to use, as Bjarne Stroustrup did not wish to restrict them in any way.11 In fact, quoting his exact words, he states I strongly felt then, as I still do, that there is no one right way of writing every program, and a language desi gner has no business trying to force programmers to use a particular style.11 The language designer does, on the other hand, have an obligation to encourage and support a variety of styles and practices that have proven effective and to provide language features and tools to help programmers avoid the well known traps and pitfalls.11Bjarne Stroustrup continues his paper by explaining further the features available to C with class, a language considered to be a stepping stone in creating C++.11 C with Classes does not differ greatly compared to C.11 Due to the fact that a preprocessor was used to implement C with Classes, the language differs only in the newly added features.11 He lists these features which are shown as below. Note that the buy the farm three features were implemented in 1981, whilst the others were implemented one year earlier.11classes11derived classes11public/private access control11constructors and destructors11call and Return functions11friend Classes11type Che cking and Conversion of Function arguments11inline functions11default arguments11 hooking of the assignment operator11 unity of the major features offered by C with Classes was the idea of classes.12 Stroustrup describes a class as a user-defined data type, meaning that it is a custom data type created by the programmer.12 He continues by stating that a class specifies the type of the class members that define the representation of a variable of the type, specifies the set of operations that manipulate such objects and specifies the access users have to these members.12 In other words, it simply defines the attributes and methods of a data type, including their access rights.12At that time, Simula did not support local or global variables of class types, and therefore objects of classes had to be allocated on the free store using the new operator.12 After developing his simulator earlier in Cambridge, he considered Simulas lack of support on variables of class types as a major sourc e of inefficiency at run-time.12 Moreover, after some time, Karel Babcisky, who worked at the Norwegian Computer Centre, published information on Simula run-time performance that backed Stroustrups thinking. For this reason, Stroustrup wanted to support local and global variables of class types.12The first version of C with Classes did not support Inline Functions, and therefore was not initially advantageous of the languages representation. Stroustrup, in his book, The C++ Programming Language, describes an inline specifier on a function as a hint to the compiler that it should try to create code for a call.5 He introduced inline functions to avoid programmers crossing a protection barrier that otherwise would result in not allowing the classes to be used hide representation.12Another concept, which Stroustrup thought about deeply, was the linkage model. Stroustrup starts explaining this by stating that to a certain extent, the way compiled programs might link to one another, deter mines the features the language can provide.12 At the time of implementing C with Classes and C++, he had taken certain decisions regarding this issue. Firstly, that separate compilation should be possible with traditional C/FORTRAN UNIX/DOS style linkers.12 Secondly, type safety should be checked on linkages.12 Thirdly, it is not necessary for a linkage to need some dissever of database, but a database could be beneficial in order to straighten the intended implementation.12 Lastly, linkage to program fragments written in other languages such as C, assembler and FORTRAN should be easy and efficient.12Bjarne Stroustrup also added unmoving types to his language implementation.12 By his experience with Simula and ALGOL 68, he considered this to be essential in supporting static types.12 The only difficulty for him was how to implement it.12 In order not to break C code, Stroustrup decided that he would allow the call of an undeclared function and not test type safety on such undecla red functions.12 However, this was a gaping hole in the type system and a great effort was made to lessen the problems relating to this issue.12 C with Classes had lost the capability to detect run-time errors caused by simple type errors.12 Due to the fact that most programmers that worked with C were reliable on type checks available, finding simple errors was tedious when programming in C with Classes.12 Thus, a great demand arose to strengthen C with Classs type system.12 Eventually, in C++ the issue had been solved by making a call of an undeclared function illegal.12Derived classes were also another concept which Stroustrup implemented.14 However, the C with Classes language did not support Simulas concept of virtual function until later with the introduction of C++.14 Similar to Simulas prefix class notion and Smalltalks subclass concept, C++ also supported derived classes.14 However, Stroustrup gave the names derived class and base class, mainly due to the fact that he, alon g with others, had difficulty in recalling what was sub and what was super.14 Furthermore, a number of people believed it to be counterintuitive as a subclass usually has more inform than its superclass.14 Although there was no support of virtual functions within C with Classes, derived classes were beneficial for creating new data structures based on older ones and linking operations with the resulting types.14 However, programmers could have simply used an object of a derived class and consider its base class as implementation details.14Towards the middle of his paper, Stroustrup mentions the reasons why he chose the programming language C to extend on, rather than Pascal.13 Although he points out that C is not the cleanest language ever designed nor the easiest to use, he selected C due to its flexibility, efficiency, availability and portability.13C++Between 1982 and 1984, Stroustrup developed the touristy programming language C++. Initially known as C84, it was later changed t o C++ because C84 was described by Stroustrup as ugly and institutional.Compared to C with Classes, C++ includes major upgrades and new features. Listed by Stroustrup, these major additions includeVirtual functions15Function name and operator overloading15References15Constants (const)15User-controlled free-store memory control15Improved type checking15The ability to overload an operator was in demand by umteen.16 Stroustrup too liked the concept, and to him, Operator overloading looked neat.16 Although, through his experience of ALGOL 68, he had an idea on how overloading could be made to work, at first he was reluctant, to add it to C++.16 The reason for this was that Overloading was known to be hard to implement and therefore resulted in compilers increasing in size.16 It was also known to be inherently inefficient and made code incomprehensible.16 However, if this reputation proved to be incorrect, Bjarne Stroustrup, at that time, admitted that overloading would solve a lot of C ++ user problems.16 He was convinced that overloading would not result in inherent inefficiency.16 Furthermore, he mentions that overloading makes code obscure and it would make their code appear cleansing agent.16 He also observed the way Overloading would work with classes, and he prepared manual papers to show that the added complexity would not pose any problems.16 Due to all these reasons, in addition to two hours of work in implementing overloading in C front for demonstrations, Stroustrup had convinced himself to include overloading to C ++.16Among other features, the concept of referencing was added to C++.16 References were initially added to support overloading.16 C passed arguments by value.16 If passing an object by value would result in inefficiency, the programmer is able to pass a pointer.16 However, overloading operators did not permit this strategy.16 Therefore, due to the fact that C ++ supports both pointers and references, it does not need means for distinguishi ng operations on the reference itself from operations on the object referred to.16From the initial version of C ++ to the C++ currently available today, a lot of updates and versions were released.17 Version 2.0 was a great improvement.17 Amongst other features, it mainly introduced abstract classes and multiple inheritance.17 Multiple inheritance allows users to have more than one direct base class.17 However, Stroustrup did admit that adding multiple inheritance in version 2.0 was a mistake, as he felt that this concept was less important than adding parametrized types.17 Parametrized types were later added in version 3.0.17The Java Programming LanguageThe Java Programming Language was developed by a team Sun Microsystems engineers, led by pack Gosling3. The project started in 1991 and was released in 1995.3PrehistoryBack in the late 1970s, Bill Joy, the man who many still believe was the first to come up with the idea of a programming language that later became Java, wanted to c reate a language that would consist of the best features of MESA and C.3 Having attempted to re-write UNIX in 1980, he realised that C++ was inadequate to accomplish this task.3 He wanted a much more powerful tool that is able to write short and effective programs. 3This longing started to become a realness in 1991, when Sun Microsystems began to develop a language induced by Joys idea.3 The Suns project was initially known as the stealth Project named by Scott McNealy.3 It was during January of that year, when pack Gosling, Mike Sheradin, Patrick Naughton and Bill Joy, along with others, organized a meeting in Aspen Colorado, to discuss their ideas for this project.3 The main aim of the Stealth Project was to conduct research in the area of computers use in the consumer electronics market.3 The major objective was to create a smart consumer electronic device that would accept instructions from a handheld-romote-control-like device.3 In Goslings words, he states that the goal was to build a system that would let us do a large, distributed, heterogeneous network of consumer electronic devices all talking to each-other.3The Stealth Project later came to be known as the Green Project.3 The work that was done by the team was divided as follows Mike Sheradin worked on business development, Patrick Naughton focused mainly on the graphics system, whilst James Gosling took the task of finding the proper language to use for the project. 3Before joining Sun in 1984, James Gosling created the commercially unsuccessful NeWs windowing system as well as GOSMACS.3 As described by the site, GOSMACS was a C language implementation of GNU EMACS.3Oak Programming LanguageThe language James Gosling initially had chosen to use for Green Project was C++.3 However, after some time working on it, he found it inadequate for the required task.3 Therefore, he began adding extensions and changes to C++, which were described as the first create blocks in developing an independent lang uage that would fit ideally to achieve the projects objectives.3 Gosling named the language Oak, while he was staring at an oak tree though his office window.3 However, some time after, the name was abolished mainly due to the fact that the name had already been in use for another programming language.3 In fact Gosling stated that the Java development team discovered that Oak was the name of a programming language that predated Suns language, so another name had to be chosen.3It was later called Java. Gosling recounted that its surprisingly difficult to find a good n

No comments:

Post a Comment