Author of the programming language c. §1 General information about the language

C++ programming language

Last update: 08/28/2017

The C++ programming language is a high-level compiled programming language general purpose statically typed, which is suitable for creating a wide variety of applications. Today, C++ is one of the most popular and widespread languages.

It has its roots in the C language, which was developed in 1969-1973 at Bell Labs by programmer Dennis Ritchie. In the early 1980s, Danish programmer Bjarne Stroustrup, then working at Bell Labs, developed C++ as an extension to the C language. In fact, in the beginning, C++ simply supplemented the C language with some object-oriented programming capabilities. And that’s why Stroustrup himself initially called it “C with classes.”

Subsequently, the new language began to gain popularity. New features were added to it that made it not just an addition to C, but a completely new programming language. As a result, “C with classes” was renamed to C++. And from then on, both languages ​​began to develop independently of each other.

C++ is a powerful language, inheriting rich memory capabilities from C. Therefore, C++ often finds its use in system programming, in particular, when creating operating systems, drivers, various utilities, antiviruses, etc. By the way, Windows OS is mostly written in C++. But only system programming application of this language not limited. C++ can be used in programs of any level where speed and performance are important. It is often used to create graphical applications, various application programs. It is also especially often used to create games with rich, rich visualization. Besides, in Lately The mobile direction is gaining momentum, where C++ has also found its application. And even in web development, you can also use C++ to create web applications or some supporting services that serve web applications. In general, C++ is a widely used language in which you can create almost any type of program.

C++ is a compiled language, which means that the compiler translates source in C++ into an executable file that contains a set of machine instructions. But different platforms have their own characteristics, so compiled programs cannot simply be transferred from one platform to another and run there. However, at the source code level, C++ programs are largely portable unless some OS-specific functions are used. And the availability of compilers, libraries and development tools for almost all common platforms allows you to compile the same C++ source code into applications for these platforms.

Unlike C, the C++ language allows you to write applications in an object-oriented style, representing a program as a collection of classes and objects interacting with each other. Which simplifies the creation of large applications.

Main stages of development

In 1979-80, Bjarne Stroustrup developed an extension to the C language - "C with Classes". In 1983 the language was renamed C++.

In 1985, the first commercial version of the C++ language was released, as well as the first edition of the book "The C++ Programming Language", which represented the first description of this language in the absence of an official standard.

Was released in 1989 a new version C++ 2.0 language, which included a number of new features. After this, the language developed relatively slowly until 2011. But at the same time, in 1998, the first attempt was made to standardize the language by the ISO organization (International Organization for Standardization). The first standard was called ISO/IEC 14882:1998, or C++98 for short. Subsequently, in 2003, a new version of the C++03 standard was published.

In 2011 it was published new standard C++11, which contained many additions and enriched the C++ language with a large number of new functionality. Following this, a small addition to the standard, also known as C++14, was released in 2014. And another key release of the language is scheduled for 2017.

Compilers and development environments

To develop programs in C++, you need a compiler - it translates the source code in C++ into an executable file, which you can then run. But at the moment there are many different compilers. They may differ in various aspects, in particular in the implementation of standards. A basic list of compilers for C++ can be found on Wikipedia. It is recommended for development to choose those compilers that are developing and implement all the latest standards. Thus, throughout this tutorial we will primarily use the freely available g++ compiler developed by the GNU Project.

You can also use IDEs such as Visual Studio, Netbeans, Eclipse, Qt, etc. to create programs.

History of creation

The language originated in the early 1980s, when Bell Labs employee Björn Stroustrup came up with a number of improvements to the C language for his own needs. When Stroustrup began working at Bell Labs in the late 1970s on problems in queuing theory (as applied to modeling telephone calls), he found that attempts to use the then existing modeling languages ​​were ineffective, and the use of highly efficient machine languages ​​was too difficult to implement. for their limited expressiveness. Thus, the Simula language has features that would be very useful for developing large software, but is too slow, and BCPL is fast enough, but too close to low-level languages ​​and not suitable for large software development.

Recalling the experience of his dissertation, Stroustrup decided to supplement the C language (BCPL's successor) with the capabilities available in the Simula language. C language being the base language UNIX systems, which Bell computers ran on, is fast, feature-rich, and portable. Stroustrup added the ability to work with classes and objects. As a result, practical modeling problems turned out to be easy to solve both in terms of development time (thanks to the use of Simula-like classes) and in terms of computation time (thanks to the speed of C). First of all, classes (with encapsulation), class inheritance, strong type checking, inline functions and default arguments were added to C. Early versions of the language, originally called "C with classes", became available in 1980.

While developing C with classes, Stroustrup wrote a program called cfront, a translator that converted C source code with classes into plain C source code. This allowed him to work on the new language and use it in practice, using the infrastructure already available in UNIX for C development. New language, unexpectedly for the author, gained great popularity among his colleagues and soon Stroustrup could no longer personally support him, answering thousands of questions.

When creating C++, Björn Stroustrup wanted
  • Get a general-purpose language with static data types, the efficiency and portability of the C language.
  • Directly and comprehensively support a variety of programming styles, including procedural programming, data abstraction, object-oriented programming, and generic programming.
  • Give the programmer freedom of choice, even if it gives him the opportunity to choose wrongly.
  • Maintain compatibility with C as much as possible, thereby making an easy transition from C programming possible.
  • Avoid discrepancies between C and C++: any construct that is valid in both languages ​​must mean the same thing in each of them and lead to the same program behavior.
  • Avoid features that are platform dependent or not universal.
  • “Don't pay for what you don't use”—no language feature should cause performance degradation for programs that don't use it.
  • Do not require an overly complicated programming environment.

The choice of C as the basis for creating a new programming language is explained by the fact that the C language:

1. is a multi-purpose, concise and relatively low-level language;
2. suitable for solving most system problems;
3. performed everywhere and on everything;
4. interfaces with the UNIX programming environment.

— B. Stroustrup. C++ programming language. Section 1.6

Despite a number of known shortcomings of the C language, Stroustrup decided to use it as a basis, since “C has its problems, but a language developed from scratch would have them, and we know the problems of C.” In addition, this made it possible to quickly obtain a prototype compiler (cfront), which only translated the added syntactic elements into the original C language.

As C++ developed, other features were included that covered the capabilities of C constructs, and therefore the question of abandoning language compatibility by removing obsolete constructs was repeatedly raised. However, compatibility has been maintained for the following reasons:

  • preservation of the current code, originally written in C and directly transferred to C++;
  • eliminating the need to retrain programmers who previously studied C (they only need to learn new C++ tools);
  • eliminating confusion between languages ​​when sharing(“if two languages ​​are used together, their differences should either be minimal or so great that it is impossible to confuse the languages”).

By 1983, new features had been added to the language, such as virtual functions, function and operator overloading, references, constants, user control over free memory management, improved type checking, and a new comment style (//). The resulting language was no longer just an augmented version of classic C and was renamed from C with classes to “C++”. Its first commercial release took place in October 1985.

The resulting language name comes from the C++ unary postfix increment operator (increasing the value of a variable by one).

Before official standardization began, the language was developed mainly by Stroustrup in response to requests from the programming community. The function of standard descriptions of the language was performed by published works on C++ written by Stroustrup (description of the language, reference guide and so on).

History of standards

In 1985, the first edition of The C++ Programming Language was published, providing the first description of the language, which was extremely important due to the lack of an official standard.


In 1989, C++ version 2.0 was released. Its new features included multiple inheritance, abstract classes, static member functions, constant functions, and protected members. In 1990, the “Annotated Reference Guide to C++” was published, which later became the basis of the standard. Latest updates included templates, exceptions, namespaces, new types of casting, and the Boolean type.

The C++ Standard Library also evolved with it. The first addition to the C++ standard library was I/O streams, which provide a means to replace the traditional C printf and scanf functions. Later, the most significant development of the standard library was the inclusion of the Standard Template Library.

In 1998, the language standard ISO/IEC 14882:1998 (known as C++98), developed by the C++ Standards Committee (ISO/IEC JTC1/SC22/WG21 working group), was published. The C++ standard does not describe how objects are named, some exception handling details, and other implementation-detailed features, making object code produced by different compilers incompatible. However, many standards have been created by third parties for specific architectures and operating systems.

In 2005, Library Technical Report 1 (abbreviated as TR1) was released. While not officially part of the standard, the report describes extensions to the standard library that the authors expected to be included in the next version of the C++ language. TR1 support is improving in almost all supported C++ compilers.

Since 2009, work has been carried out to update the previous standard, the preliminary version of the new standard was first C++09, and a year later C++0x, today C++11, which included additions to the core of the language and an expansion of the standard library, including including most of TR1.

C++ continues to evolve to meet today's demands. One of the groups developing the C++ language and submitting proposals for its improvement to the C++ standardization committee is Boost, which is engaged, among other things, in improving the capabilities of the language by adding metaprogramming features to it.

Nobody owns the rights to the C++ language; it is free. However, the language standard document itself (excluding drafts) is not available for free.

Tags: History of C, ANSI C, ISO C, C99, C11, ISO/IEC C, C standardization.

Origins

C and is a "by-product" obtained during creation operating system UNIX, which was developed at Bell Laboratories by Ken Thompson, Denis Ritchie and co. Thompson single-handedly wrote the original version of UNIX, which ran on the DEC PDP-7, one of the first minicomputers with only 8K words of main memory (it was 1969, after all).

Like other operating systems of the time, UNIX was written in assembly language. Debugging assembly language programs is a real pain and difficult to improve, and UNIX was no exception. Thompson decided that a language was needed to further develop the OS high level and came up with a small language B. Thompson based it on the BCPL language, a language for system programming, developed in the mid-60s. BCPL, in turn, originates from ALGOL 60, one of the very first (and most influential) greatest influence) languages.

Ritchie soon joined the UNIX project and began writing in B. In 1970, Bell Labs purchased a PDP-11 for the project. Since B was ready to run on the PDP-11, Thompson rewrote part of UNIX into B. In 1971 it became clear that B was not quite suitable for the PDP-11, so Ritchie began creating an expanded version of B. At first he called it NB (New B ), but when the language became very different from B, the name was changed to C. By 1973, the language had become stable enough for UNIX to be rewritten in it. Switching to C provided an important advantage: portability. By writing a C compiler for each of the machines at Bell Labs, the development team could port UNIX to them.

Standardization

C continued to evolve in the 70s, especially between 1977 and 1979, when the first book on C was published. The C Programming Language, written by Brian Kernighan and Denis Ritchie and published in 1978, became the bible of C programmers. In the absence of an official standard, this book - also known as K&R, or the "White Book" as C fans like to call it - has become the de facto standard. In the 70s there were few C programmers and most of them were UNIX users. However, in the 1980s, C expanded beyond the narrow confines of the UNIX world. C compilers have become available on a variety of machines running different operating systems. In particular, C began to spread on the rapidly developing IBM PC platform.

Along with the increase in popularity came problems. Programmers who wrote new compilers took the language described in K&R as a basis. Unfortunately, in K&R some features of the language were described vaguely, so compilers often interpreted them at their own discretion. In addition, the book did not make a clear distinction between what is a feature of the language and what is a feature of the UNIX operating system. What made the situation worse was that after the publication of K&R, C continued to develop: new features were added to it and old ones were cut out of it. Soon there was an obvious need for a comprehensive, accurate and modern description of the language. Without such a standard, dialects of the language began to appear, which interfered with portability - the greatest strength of the language.

The development of the American C standard began in 1983 under the auspices of the American National Standards Institute (ANSI). After many revisions, the standard was finalized in 1988 and formally adopted in December 1989 as ANSI X3.159-1989. In 1990, it was approved by the International Organization for Standardization (ISO) as the international standard ISO/IEC 9899:1990. This version of the language is usually called C89 or C90, to avoid confusion with the original version of C, which is usually called K&R C.

The language underwent minor changes in 1995 (the changes are described in a document commonly called Amendment 1). More significant changes occurred in 1999, when the ISO/IEC 9899:1999 standard was published. The language described in this standard is usually called C99. The terms "ANSI C", "ANSI/ISO C" and "ISO C", once used to describe C99, have two meanings due to the existence of two standards.

In 2011, along with the revision of the C++ language, the C11 standard was released. Despite the existence of the '11 standard, many compilers still do not fully support even the C99 versions, so the use of the C11 standard will be explicitly stated.

C++ (read c-plus-plus) is a compiled, statically typed general-purpose programming language in which you can create programs of any level of complexity.
For more than 20 years, this language has been among the three most popular and in-demand programming languages. (You can verify this by visiting the TIOBE website).
The language originated in the early 1980s, when Bell Labs employee Björn Stroustrup came up with a number of improvements to the C language for his own needs.

Bjarne Stroustrup – creator of the C++ language

Stroustrup decided to extend the C language with the capabilities found in the Simula language. C, being the base language of the UNIX system on which Bell computers ran, is fast, feature-rich, and portable. Stroustrup added the ability to work with classes and objects. As a result, practical modeling problems turned out to be easy to solve both in terms of development time (thanks to the use of Simula-like classes) and in terms of computation time (thanks to the speed of C).
Here's how the language developer himself talks about it:



In 1998, the first language standard, known as C++98, was published by a standards committee. C++ continues to evolve to meet today's demands. One of the groups developing the C++ language and submitting proposals for improving it to the C++ Standards Committee is Boost, which is engaged, among other things, in improving the capabilities of the language by adding metaprogramming features to it. The latest standard was released in 2017 and is called C++17. The next standard will not be long in coming and is expected to appear in 2020.
Nobody owns the rights to the C++ language; it is free. In March 2016, Russia was created working group RG21 C++. The group was organized to collect proposals for the C++ standard, send them to a committee and defend them at general meetings of the International Organization for Standardization.
C++ is a multi-paradigm language (from the word paradigm - writing style computer programs), including a wide range of different programming styles and technologies. It is often classified as an object-oriented language, but strictly speaking, this is not the case. During the work process, the developer receives absolute freedom in choosing tools so that the problem solved using a particular approach is solved as efficiently as possible. In other words, C++ does not force the programmer to adhere to only one style of program development (for example, object-oriented).
C++ has a rich standard library that includes common containers and algorithms, I/O, regular expressions, multithreading support and other features. C++ has influenced many programming languages, including: Java, C#, D. Since C++ belongs to a family of languages ​​based on the syntax of the C language, you can easily master other programming languages ​​of this family: JavaScript, PHP, Perl, Objective-C and many others . etc., including the parent language itself - C. ()
During its existence, the C++ language has acquired persistent myths that are easily refuted (see here: Part 1 and Part 2)

History of the language and standards release

1983

The creator of the language is Björn Stroustrup, a Bell Labs employee, introduced an early version of the C++ language (“C with classes”)

1985

First commercial release of C++, the language takes on its modern name

1986

Release of the first edition of The C++ Programming Language- a book on C++ written by Björn Stroustrup

1998

The international standard for the C++ language has been ratified: ISO/IEC 14882:1998 “Standard for the C++ Programming Language”

2003
2005

Library Technical Report 1 (TR1) has been released. While not officially part of the standard, the report described extensions to the standard library that should be included in the next version of the C++ language.

2011

Release of a new standard – C++11 or ISO/IEC 14882:2011; the new standard included additions to the language core and expansion of the standard library, including most of TR1

2014

Release of the C++14 standard (“International Standard ISO/IEC 14882:2014(E) Programming Language C++”); C++14 can be seen as a small extension over C++11, containing mostly bug fixes and minor improvements

2017

The release of a new standard – C++1z (C++17). This standard introduced many changes and additions. For example, STD included libraries of the C11 standard, file system, based on boost::filesystem, a large part of the experimental TS I library.

2020

C++20 is the unofficial name of the ISO/IEC standard for the C++ programming language, which is expected to follow C++17. Draft N4800 standard.

C++ Philosophy

In his book The Design and Evolution of C++ (2007), Björn Stroustrup describes the principles he followed when designing C++ (abbreviated):

  • Get a general-purpose language with static data types, the efficiency and portability of the C language.
  • Directly and comprehensively support a variety of programming styles.
  • Give the programmer freedom of choice, even if it gives him the opportunity to choose wrongly.
  • Maintain compatibility with C as much as possible, thereby making an easy transition from C programming possible.
  • Avoid discrepancies between C and C++: any construct that is valid in both languages ​​must mean the same thing in each of them and lead to the same program behavior.
  • Avoid features that are platform dependent or not universal.
  • “Don't pay for what you don't use” - no language feature should lead to a decrease in the performance of programs that do not use it.
  • Do not require an overly complicated programming environment.

C and C++

The syntax of C++ is inherited from the C language. Although, formally, one of the principles of C++ remains maintaining compatibility with the C language, in fact, the standardization groups for these languages ​​do not interact, and the changes they make not only do not correlate, but often fundamentally contradict each other ideologically. Thus, the elements that the new C standards add to the kernel are in the C++ standard elements of the standard library and are not in the kernel at all, for example, dynamic arrays, arrays with fixed boundaries, facilities parallel processing. According to Stroustrup, combining the development of these two languages ​​would be of great benefit, but it is unlikely to be possible for political reasons. So practical compatibility between C and C++ will gradually be lost.
IN in this example, depending on the compiler used, either “C++” or “C” will be output:

Program 9.1

#include int main() ( printf("%s\n", (sizeof("a") == sizeof(char)) ? "C++" : "C"); return 0; )

This is due to the fact that character constants in C are of type int , and in C++ they are of type char , but the sizes of these types are different.

Application Lifecycle Models

Life cycle software is a period of time that begins from the moment a decision is made about the need to create software product and ends at the moment of its complete withdrawal from service. This cycle is the process of building and developing software. There are several life cycle models.
Cascade model life cycle (English waterfall model) was proposed in 1970 by Winston Royce. It provides for the sequential implementation of all stages of the project in a strictly fixed order. The transition to the next stage means the complete completion of work at the previous stage. The requirements determined at the stage of requirements formation are strictly documented in the form of technical specifications and are recorded for the entire development of the project. Each stage culminates in the release of a complete set of documentation sufficient to allow development to be continued by another development team.
Project stages according to the waterfall model:

  1. Formation of requirements;
  2. Design;
  3. Implementation;
  4. Testing;
  5. Implementation;
  6. Operation and maintenance.

In the cascade model, the transition from one project phase to another assumes that the result of the previous phase is completely correct. In large projects this is almost impossible to achieve. Therefore, this model is only suitable for developing a small project. (W. Royce himself did not adhere to this model and used an iterative model).
Iterative model
An alternative to the cascade model is the iterative and incremental development (IID) model, which received from T. Gilb in the 70s. name of the evolutionary model. The IID model involves breaking the project life cycle into a sequence of iterations, each of which resembles a “mini-project”, including all development processes applied to the creation of smaller pieces of functionality compared to the project as a whole. The goal of each iteration is to obtain a working version software system, including the functionality defined by the integrated content of all previous and current iterations. The result of the final iteration contains all the required functionality of the product. Thus, with the completion of each iteration, the product receives an increment - an increment - to its capabilities, which, therefore, develop evolutionarily.


Various variants of the iterative approach are implemented in most modern development methodologies:

Development Process - Rational Unified Process (RUP)

Rational Unified Process (RUP)(rational unified process) is a software development methodology maintained by Rational Software (IBM). The methodology provides recommendations for all stages of development: from business modeling to testing and commissioning of the finished program. The Unified Modeling Language (UML) is used as a modeling language.
The complete product development life cycle consists of four phases, each of which includes one or more iterations.

  • Initial stage (Inception)
  • Determining the scope of the project and the amount of resources required. The basic requirements, limitations and key functionality of the product are determined. Risks are assessed. Action planning. At the end of the initial phase, the achievement of the Lifecycle Objective Milestone is assessed, which presupposes an agreement between stakeholders to continue the project.

  • Clarification
  • Documenting requirements. Design, implementation and testing of executable architecture. Clarification of terms and costs. Reducing key risks. Successful completion of the development phase means reaching the Lifecycle Architecture Milestone.

  • Construction
  • In the “Build” phase, most of the product’s functionality is implemented: the application design is completed, the source code is written. The Build phase ends with the first external release of the system and the Initial Operational Capability milestone.

  • Introduction
  • In the “Implementation” phase, a Final version product and is transferred from the developer to the customer. This includes a beta testing program, user training, and determining the quality of the product. In case the quality does not meet user expectations or the criteria set in the Start phase, the Implementation phase is repeated again. Completing all goals means achieving the Product Release milestone and completing the full development cycle.



« Information technology. System and software engineering. Life Cycle Processes software". This standard was adopted by the Federal Agency for Technical Regulation and Metrology of the Russian Federation and is similar to the international standard ISO/IEC 12207:2008. This standard, establishes a general framework for software life cycle processes that can be used to guide the software industry. The standard does not offer specific model life cycle. Its provisions are common to any life cycle models, methods and technologies for software creation. It describes the structure of life cycle processes without specifying how to implement or complete the activities and tasks included in those processes.

Presentation for the lesson
Message topics
  • Free Software Foundation (FSF)
  • Free software licenses
  • FreeSoftware and Open Source
  • History of the development of programming languages
  • The history of the C language. C and C++
  • Story
  • Criticism of C++
  • History of UNIX
  • Spiral software life cycle model
  • UML (Unified Modeling Language)
  • Microsoft Solutions Framework
  • IDE for C/C++ programming on Windows
  • C/C++ compilers
  • Creating a Console Application on Windows
Questions
  1. Why is the waterfall model of software development not used in large projects?
  2. What is the difference between waterfall and iterative development models?
  3. List the stages of software development in the Rational Unified Process (RUP) methodology